<template>
	<!--cosPDP页面-->
	<view
		:class="[activitySwitch?'bottom100':'',noticeText.length>0?'notice-none':'', (tsOrderInfo.isTsDraw || tsInfo.selectionEnabled)?'bottom106':'']">
		<loading :showLoaded.sync="showLoaded"></loading>
		<!-- <navBar  :navbarData.sync=" isSpecial || activitySwitch?navbarData :navbarDataNew"></navBar> -->
		<navBar :navbarData.sync="navbarDataNew"></navBar>

		<t-captcha id="captcha" size="small" app-id="2091997383" @verify="handlerVerify" @ready="handlerReady"
			@close="handlerClose" @error="handlerError"></t-captcha>
		<!-- <block v-if="isShow"> -->
		<view class="new-page-container">
			<luBarTabNav class="shoppingCart lubar-class" :selectedIndex="selectedIndex" :tabList="tabList" :barShow="barShow"
				:barFixed="barFixed" :iconShow="iconShow" :transitionShow="transitionShow" :barHeight="barHeight"
				:barTop="barTop" :barId="barId" ref="barTabNav" :style="{paddingBottom: detailHeight + 'px',}"
				:class="showLoaded?'set-hidden':'set-show'" @tabSensors="tabSensors">
				<NoticeNav :text='navText' v-if="drawTask"></NoticeNav>
				<u-notice-bar v-if="noticeText.length>0 && !drawTask" fontSize='26' :list="noticeText" class='noticeBar'
					bg-color='#4d4d4d' :volume-icon='false' color='#ffffff' padding='24rpx 0 22rpx'></u-notice-bar>
				<view id="item1" class="tabbody">
					<view style="position: relative; width: 100%;height:auto">
						<swiperComponentNew ref="swiperRef" :carouselArrId='carouselArrId' :detail='detail'
							:pdpShowVideoConfig='pdpShowVideoConfig' :isC2Bgoods="isC2Bgoods" :isC2BgoodsIndex="isC2BgoodsIndex" @handleToC2bPage="handleToC2bPage">
						</swiperComponentNew>
						<view class="new-goods-tag-box">
							<block v-for="(tag, tagI) in basicsTag" :key="tagI">
								<view class="new-goods-tag-item" v-if="tag.status==goodsStatus && tag.isShow">
									<image style="width:auto;height:56rpx;" :src="tag.image" mode="heightFix">
									</image>
								</view>
							</block>
						</view>
					</view>
					<!-- 商品主要信息 -->
					<view style="padding: 48rpx;">
						<!-- //标题 -->
						<view class="new-title new-flex-box" id="jump">
							<div class="new-item-title-left" style="font-family: FrankNew-Regular;">{{title_EN }}</div>
							<view class="new-item-title-right">
								<view class="new-icon-image" @click="fastTabClick(isLove, 1)" >
									<image style="width:64rpx;height:64rpx" :src="isLove.isAct ? isLove.actIcon : isLove.icon"
										mode="widthFix">
									</image>
								</view>
								<button class="new-share-btn " @click="skipShare" v-if="!disableShare">
									<image style="width:64rpx;height:64rpx"
										src="https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Share.png"
										mode="widthFix"></image>
								</button>
							</view>
						</view>
						<!-- //名称 -->
						<view class="cart-title flex-box"
							style="font-family: NotoSansSC-Medium ;font-size: 36rpx;margin-bottom: 24rpx;width: 570rpx;color:#000">
							<text decode="true" class="item-title-left ellipsis"
								style="font-family: FrankNew-Medium,NotoSansSC-Medium ;font-size: 36rpx;margin-bottom: 24rpx;width: 570rpx;color:#000">{{detail.newitemName }}</text>
						</view>

						<view class="material-tag" v-if="ccJson[valueId].frontMaterialTag">
							{{ccJson[valueId].frontMaterialTag }}
						</view>
						<!-- 价格 -->
						<view class="cart-price" :class="isC2Bgoods?'cart-price-c2b':''">
							<view class="new-price-box" style="display: flex; ">
								<view class="price" v-if="price > 0">
									<text class="mark fs18" style="margin-right: 4rpx;">¥</text>
									<text
										style="font-family: FrankNew-Regular;">{{ priceString ? price : filterChecked.moneyFormat(price, 2) }}</text>

								</view>
								<view v-if="!!isSpecial && tsInfo" class="special-box">
									<view class='flex-box' style="justify-content: flex-start;align-items: center;">
										<view
											style="margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2; font-family: NotoSansSC-Medium;"
											v-if="!!tsInfo.purchaseLimitDisplay">
											{{ tsInfo.purchaseLimitLabel }}
										</view>
										<view
											style="margin-left: 24rpx; font-size: 20rpx;color: #fff;background: #CB171A;height: 40rpx;line-height: 40rpx;font-family: NotoSansSC-Medium"
											v-if="!!tsInfo.pointsRateDisplay">{{ tsInfo.pointsRateLabel }}
										</view>
									</view>
								</view>
								<view v-if="colorPriceJson.colorList.length > 0 " class="special-box">
									<view class='flex-box'
										style="justify-content: flex-start;align-items: center;font-family: NotoSansSC-Medium"
										v-if="!!promotionArr && promotionArr.length > 0 && !isSpecial">
										<!-- 促销标签 -->
										<block v-for="(proItem, proIndex) in promotionArr" :key="proIndex">
											<!-- 会员提前购标签 -->
											<view
												v-if="proItem.promotionType == 'forward_purchase' && filterChecked.forwardPurchaseTag(proItem.memberLevelIds, memberLevelId, memberIsActive) && filterChecked.filterCustomerGroupPromotionTag(proItem.groupIds, customerGroupId)"
												style="margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2;font-family: NotoSansSC-Medium">
												{{ proItem.promotionTag }}
											</view>
											<!-- 常规促销标签 -->
											<block
												v-if="proItem.promotionType !== 'forward_purchase' && proItem.promotionType !== 'custom_tag'">
												<block
													v-if="proItem.groupIds &&filterChecked.filterCustomerGroupPromotionTag(proItem.groupIds, customerGroupId)">
													<view
														style="margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2;font-family: NotoSansSC-Medium">
														{{ proItem.promotionTag }}
													</view>

												</block>
												<block v-else>
													<!-- <view :style="'margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2; color:'+ proItem.tagStyle ? proItem.tagStyle : '#ff571a'"> -->
													<view
														style="margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2;font-family: NotoSansSC-Medium">
														{{ proItem.promotionTag }}
													</view>
												</block>
											</block>
										</block>
									</view>

									<!-- 自定义标签 -->
									<block v-for="(proItem, cusProIndex) in customPromotionArr" :key="cusProIndex">
										<block v-if="proItem.promotionType == 'custom_tag'">
											<block v-if="filterChecked.promotionTime(proItem.beginTime,proItem.endTime)">
												<block v-if="proItem.groupIds">
													<block
														v-if="filterChecked.filterCustomerGroupPromotionTag(proItem.groupIds, customerGroupId)">
														<!-- <view :style="'margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2; color:'+ proItem.tagStyle"> -->
														<view
															style="margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2;font-family: NotoSansSC-Medium">
															{{ proItem.promotionTag }}
														</view>
													</block>
												</block>
												<block v-else>
													<!-- <view :style="'margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2; color:'+ proItem.tagStyle"> -->
													<view
														style="margin-left: 24rpx; padding: 8rpx 16rpx;background-color: #F2F2F2;font-family: NotoSansSC-Medium">
														{{ proItem.promotionTag }}
														{{ proItem.promotionTag }}
													</view>
												</block>
											</block>
										</block>
									</block>

								</view>
							</view>
							<block v-if="isC2Bgoods">
								<view class="c2b_tips_btn" @click.stop="handleToC2bPage">定制镌刻</view>
							</block>
						</view>

						<!-- 版本 -->
						<view class="new-v" v-if="tagList && tagList.length">
							<view class="v-title">版本: </view>
							<view class="v-textbox">
								<block v-for="(tag, tagI) in tagList" :key="tagI">
									<view :class="['new-tag',tagI==selectTagI? 'tag-active': 'tag-d']" @click="selectTag(tagI,tag)">
										{{tag.versionName}}
									</view>
								</block>
							</view>
							
						</view>

					</view>

					<view class="progress-title-box" v-if="activitySwitch">
						<view style="font-family: NotoSansSC-Regular;font-size:28rpx">不凡甄选</view>
						<view class="progress-title-btn-box">
							<view class="drawLotsRule" @click="skipRule()">
								活动规则
							</view>
							<view class="drawLotsRule" @click="skipRule2()">
								探索更多
							</view>
						</view>

					</view>
					<!-- 抽签购进度 -->
					<view class="draw-progress" v-if="activityInfo">
						<progress :exTime='exTime' :activityInfo='activityInfo'></progress>
					</view>
				</view>
				
				<view id="item3" class="tabbody" v-if="utoolsData">
					<view>
						<view class="description-header-new">
							商品详情
						</view>
						<utools-parse id="utools-parse" @triggerComponent="onTriggerComponent" :utools-data="utoolsData"
							@onAddCart="onAddCart"></utools-parse>
					</view>
				</view>
				<view id="item3" class="tabbody" v-else>
					<!-- 商品描述 -->
					<view class="description-header-new">
						商品详情
					</view>
					<view class="product-description">
						<view class="description-text is-open">
							<u-parse :content="uData"></u-parse>
						</view>
					</view>
					<view style=" clear: both;"></view>

				</view>


				<view id="item4" class="tabbody" v-if="recommendUtools && utoolsClassGoodsLists">
					<utools-parse id="utools-parse-cart" page="cart" @triggerComponent="onTriggerComponent"
						:utools-data="recommendUtools" @onAddCart="onAddCart"></utools-parse>
				</view>

			</luBarTabNav>


			<!-- 底部导航 -->
			<view class="detail-bottom-top" :class="[isIpx ? 'fix-iphonex-button' : '',showLoaded?'set-hidden':'set-show']">
				<!-- 抽签购底部 -->
				<view class="drawLotsBottom" v-if="activitySwitch || (isLuckyDrawItem && canBuy == 0)">

					<view class="dlTextBox " :style="{backgroundColor:dlTextBoxBgColor,textAlign:'left'}" v-if="drawTipText">
						<image style="width:32rpx; height: 32rpx;display: inline-block;margin-right: 24rpx;"
							:src="dlTextBoxBgColor !='#CB171A' ? 'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/icon@2x (1).png' : 'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/icon@2x.png'"
							mode="widthFix">
						</image>
						<view
							style="height:128rpx;line-height: 128rpx;text-align: left;color: #fff !important; font-family: FrankNew-Medium,NotoSansSC-Medium ;">
							{{drawTipText}}
						</view>
					</view>
					<view class="ao-bottom">
						<view class="left-icon flex-box" :class="(canBuy!== 0 && !showIntent)?'short':''">
							<view class="icon-item" v-for="(item, tabIndex) in fastTabNew" :key="tabIndex">
								<!-- v-if="(canBuy !== 0 && !showIntent)? tabIndex == 1: true"> -->
								<view class="new-icon-image" @click="fastTabClick(item, tabIndex)" v-if="item.type!=='adviser'">
									<image style="width:64rpx; height: 64rpx;" :src="item.isAct ? item.actIcon : item.icon"
										mode="widthFix">
									</image>
								</view>
								<button v-else @click="fastTabClick(item, tabIndex)" open-type="contact" show-message-card="true"
									class="kf_button" style="background-color:transparent">
								</button>
								<text v-if="cartNum !== 0 && item.type == 'cart'" class="number">{{ cartNum }}</text>
								<view class="left-icon-title">{{ item.title }}</view>
							</view>
						</view>
						<view class="right-btn">
							<view class="dlBtnBox" :class="blackbg?'link':''" @click="drawHandle(drawButtonText)">
								{{drawButtonText+showDate}}
							</view>
						</view>
					</view>
				</view>
				<!-- <view v-else-if=" !!isSpecial && canBuy == 0 && !!productSKU &&tsInfo" class="ts-bottom"> -->
				<view v-else-if=" !!isSpecial && canBuy == 0 && !!productSKU" class="ts-bottom">
					<tsComponentNew ref='tsRef' :productSKU='productSKU' :btnStatus='btnText' :tsActId.sync='tsActId'
						@setTsInfo='setTsInfo' :ccJsonInfo='ccJson[valueId]' :colorPriceJson='colorPriceJson' :price='price'
						:fastTab='fastTabNew' :cartNum='cartNum' :detail='detail' :valueId='valueId'
						:goodsOperateBtn='goodsOperateBtn' @youshuTrack="youshuTrack">
					</tsComponentNew>
				</view>
				
				<!-- 普通ao商品 -->
				<view class="ao-bottom" v-else>
					<view class="left-icon flex-box" :class="(canBuy!== 0 && !showIntent)?'short':''">
						<view class="icon-item" v-for="(item, tabIndex) in fastTabNew" :key="tabIndex">
							<!-- v-if="(canBuy !== 0 && !showIntent)? tabIndex == 1: true"> -->
							<view class="new-icon-image" @click="fastTabClick(item, tabIndex)" v-if="item.type!=='adviser'">
								<image style="width:64rpx; height: 64rpx;" :src="item.isAct ? item.actIcon : item.icon" mode="widthFix">
								</image>
							</view>
							<button v-else @click="fastTabClick(item, tabIndex)" open-type="contact" show-message-card="true"
								class="kf_button" style="background-color:transparent">
							</button>
							<text v-if="cartNum !== 0 && item.type == 'cart'" class="number">{{ cartNum }}</text>
							<view class="left-icon-title">{{ item.title }}</view>
						</view>
					</view>
					<view v-if="showIntent" class="intentbtn" :class="intentChecked ?'disable' : ''" @click="intentHandle">
						{{intentChecked?'取消登记':'意向登记'}}
					</view>
					<view v-else class="right-btn">
						<view class="disabled-buy" v-if="canBuy !== 0" :class="canBuy == 1 ? '' : 'hasLogin'"
							@click.stop="disabledBuy">
							{{disabledBtnText}}
						</view>
						<view class="right-btn" v-else>
							<view class="btnBox">
								<button v-if="litha" :class="lithaInfo.lithaButtonStatus?'disable':'act'" class="font-32"
									@click="lithaBook">{{lithaInfo.lithaButtonStatus?'已设置开售提醒':'商品上新通知'}}</button>
								<button v-if='!litha && btnText!=1' :class="{
				        btn_sell_Out: btnText == 1,
				        btn_invalid: btnText == 0 || btnText == 1 ,
				        btn1: enableBuyNow == true && btnText !== 0 && btnText !== 1 && btnText !== 4,
				        'addShoppingCart btn_cart': enableBuyNow == false || btnText == 0 || btnText == 1,
						btn2: btnText == 4,
						'f-none': btnText == 3,
				      }" type="primary" @click="takeCart" data-trackType='加入购物袋' data-type="cart">
									{{ btnText === 0 ? '请选择尺码' : btnText == 1? '商品已售罄' : btnText == 4 ? '查看更多' : '加入购物袋' }}
								</button>
								<button v-if="enableBuyNow && btnText == 3 && !litha" class="btn2 act f-none"
									@click.stop="buyItNow('buynow',1)" data-type="buynow" data-trackType='立即购买'>{{orderFlowText}}</button>
								<button v-if="enableArrivalNotice && arrivalBtnText == '到货提醒'  && btnText == 1" class="btn2 "
									@click.stop="arrivalNowSubscribe" data-type="buynow">{{isSpAo?'活动开始提醒': arrivalBtnText}}</button>
								<button v-else-if="enableArrivalNotice && arrivalBtnText == '已设置开售提醒' && btnText == 1"
									class="arrival-new btn2">{{isSpAo?'已设置活动开始提醒': arrivalBtnText}}</button>
							</view>
						</view>
					</view>
				</view>


			</view>

			<view class="topView" v-if="checkDialog" @touchmove.stop.prevent catchtouchmove="true">
				<view class="container">
					<view class="close" @click="closeCheckDialog('关闭')">×</view>
					<view class="text">我已阅读并同意<text class="under" @click="skipRule()">不凡甄选活动规则</text>确认并登记活动参与地址</view>
					<view class="checkBtnBox">
						<view class="btn" @click="closeCheckDialog('再想想')">再想想</view>
						<view class="btn submit" @click="checkIn()">确认登记</view>
					</view>
				</view>
			</view>

			<!-- 商品参数弹层 -->
			<view class="mask-box-2" v-if="paramsShow" @click.stop="paramsShow = false" @touchmove.stop.prevent
				catchtouchmove="true">
				<view style="border-radius: 16rpx 16rpx 0 0;overflow: hidden;" class="prams-box flex-column"
					:class="[isIpx ? 'fix-iphonex-button' : '']" @click.stop="stopClick">
					<view stayle="height:1124rpx;box-sizing: border-box;">
						<view
							style="width:750rpx; height: 144rpx;display: flex;flex-direction: row;justify-content: space-between;align-items: center;padding:0 24rpx 0 48rpx">
							<view style="font-family:NotoSansSC-Regular;font-size: 36rpx; font-weight: 400;">详细参数</view>
							<view style="width: 80rpx;height: 80rpx;" @click.stop="paramsShow = false">
								<image src="https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Close.png"
									style="width: 80rpx;height: 80rpx;" />
							</view>
						</view>

						<view style="padding:12rpx 48rpx 0; height: 980rpx;">
							<view v-for="(parmasItem, parmasIndex) in paramsJson" :key="parmasIndex" class="flex-box item-box">
								<view class="params-title">{{ parmasItem.title }}</view>
								<view class="params-content">
									{{ ccJson[valueId].frontCustomParameters[parmasItem.key] || parmasItem.value }}
								</view>
							</view>
						</view>

					</view>
					<!-- <view class="full-btn" @click.stop="paramsShow = false">完成</view> -->
				</view>
			</view>

			<!-- 温馨提示弹框 -->
			<view class="mask-box" v-if="tipShow" @click.stop="tipShow = false" @touchmove.stop.prevent catchtouchmove="true">
				<view style="border-radius: 16rpx 16rpx 0 0;overflow: hidden;" class="prams-box flex-column"
					:class="[isIpx ? 'fix-iphonex-button' : '']" @click.stop="stopClick">
					<view class="params-padding-box">
						<view
							style="width:750rpx; height: 144rpx;display: flex;flex-direction: row;justify-content: space-between;align-items: center;padding:0 24rpx 0 48rpx">
							<view style="font-family: NotoSansSC-Regular;font-size: 36rpx; font-weight: 400;">温馨提示
							</view>
							<view style="width: 80rpx;height: 80rpx;" @click.stop="tipShow = false">
								<image src="https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Close.png"
									style="width: 80rpx;height: 80rpx;" />
							</view>
						</view>
						<scroll-view style="height: 1160rpx;" scroll-y="true">
							<image style="width: 750rpx; height: auto;" mode="widthFix"
								src="https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/tipContent2.png" alt="" />
						</scroll-view>
					</view>
					<!-- <view class="full-btn" @click.stop="paramsShow = false">完成</view> -->
				</view>
			</view>
			<!--  心愿单弹窗 -->
			<FavDialog ref='favRef' from='item'></FavDialog>
			<!-- 意向单弹窗 -->
			<intentDialog ref='intentRef' :lithaButtonStatus='lithaInfo.lithaButtonStatus'>
			</intentDialog>
			<register-widget ref="registerWidgetRef" location="pdp" @finish='registerSuccess' />
			<RrawDialog v-if="showDrawCountDialog" :drawRemainingTimes='drawRemainingTimes' :countStatus='countStatus'
				@showRuleDialog='showRuleDialog' @closeDrawCountDialog='closeDrawCountDialog'>
			</RrawDialog>
			<!-- 订阅失败 -->
			<failSubscribe ref='failSubRef'></failSubscribe>
			<cart-toast v-if="showCartMsg" :bottom="isIpx ?'212rpx': '147rpx'" :cartMessage='cartMessage'
				:cartStatus="cartStatus"></cart-toast>
			<!-- 会员规则弹框 -->
			<view class="mask-box" v-if="isNewRuleShow" @click.stop="isNewRuleShow = false" @touchmove.stop.prevent
				catchtouchmove="true">
				<view style="border-radius: 16rpx 16rpx 0 0;overflow: hidden;" class="prams-box flex-column"
					:class="[isIpx ? 'fix-iphonex-button' : '']" @click.stop="stopClick">
					<view class="params-padding-box-2">

						<image style="width: 750rpx; height: auto;" mode="widthFix"
							src="https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/new-rule2.png" alt="" />
						<view @click.stop="isNewRuleShow = false"
							style="position:absolute;top:30rpx;right:14rpx; width: 90rpx;height: 90rpx"></view>
						<view style="position: absolute;right: 50rpx;bottom: 92rpx;width: 350rpx;height: 50rpx"
							@click.stop="goToRule"></view>
						<view style="position: absolute;left: 48rpx;bottom: 46rpx;width: 60rpx;height: 50rpx"
							@click.stop="goToRule"></view>
					</view>
					<!-- <view class="full-btn" @click.stop="paramsShow = false">完成</view> -->
				</view>
			</view>

			<!-- 活动规则弹框 -->
			<view class="mask-box-2" v-if="isActivityRule" @click.stop="isActivityRule = false" @touchmove.stop.prevent
				catchtouchmove="true">
				<view class="params-padding-box-3" :style="{bottom: isIpx?'414rpx':'350rpx' }" @click.stop="stopClick">
					<image style="width: 654rpx; height: auto;" mode="widthFix" :src="ruleBoxData.title" alt="" />
					<scroll-view style="height: 280rpx;width: 100%;" scroll-y="true">
						<view
							style="display: flex;flex-direction:column; justify-content: flex-start;align-items: center;padding: 0;margin:0;font-size: 0;">
							<block v-for="(img, i) in ruleBoxData.list" :key="i">
								<image style="width:100%;height:auto;" :src="img" mode="widthFix"></image>
							</block>
						</view>

					</scroll-view>
					<view @click.stop="isActivityRule = false"
						style="position:absolute;top:15rpx;right:14rpx; width: 90rpx;height: 90rpx"></view>
				</view>
			</view>
		</view>

		<!-- 弱提示 弹窗 -->
		<toast-popup ref="toastPopup" @onToastPopupClick="onToastPopupClick"></toast-popup>
	</view>
</template>
<script module="filterChecked" lang="wxs" src="../../utils/filter.wxs"></script>
<script>
	let observer = null;
	import {
		SYSTEM_INFO,
		MERCHANT_INFO,
		USER_INFO,
		USER_SPECICAL_INFO,
		CUSTOMER_INFO,
		CART_KEY,

	} from '@/utils/constant';
	import tip from '@/utils/tip';
	import api from '@/api/api';
	import util from '@/utils/util';
	import uParse from './components/feng-parse/parse.vue';
	import onlineService from '../../components/common/onlineService';
	import Loading from '../../components/common/loading';
	import NavBar from '../../components/common/navbar';
	import ItemRecommend from './itemRecommend.vue';
	import luBarTabNav from "./lu-bar-tab-nav.vue";
	import Progress from '@/pages/item/components/progress.vue';
	import RrawDialog from './drawCountDialog.vue';
	import NoticeNav from './noticeNav.vue';
	import swiperComponentNew from './components/swiperComponentNew.vue';
	import TsComponentNew from './components/tsComponentNew.vue';
	import SwiperComponent from '@/pages/item/components/swiperComponent.vue';
	import TsComponent from '@/pages/item/components/tsComponent.vue';
	import registerWidget from "@/components/register/register-widget.vue";
	import FavDialog from '@/components/common/favDialog.vue';
	import intentDialog from '@/pages/item/components/intentDialog.vue';
	import commonImages from '@/utils/commonImages';
	import failSubscribe from '@/pages/item/components/failSubscribe.vue';
	import CartToast from '@/components/common/cartToast.vue';
	import NewRuleDialog from '@/pages/item/components/newRuleDialog.vue';
	import {
		getSubscribeStatus,
		getActivitySubscribeTemplate,
		doSubscribe,
		setFav,
		getArrivalSubStatus
	} from '@/utils/commonActItems.js'
	import {
		checkFavStatus
	} from './itemUtil.js';
	export default {
		config: {
			navigationBarTitleText: '商品详情',
			enablePullDownRefresh: true
		},
		data() {
			return {
				ruleBoxData: {},
				dlTextBoxBgColor: '#000',
				isNewRuleShow: false,
				isActivityRule: false,
				showDate: '',
				timer: null,
				// 组件所需的参数
				navbarData: {
					showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
					navbarTitle: '商品详情' //导航栏 中间的标题
				},
				isShow: false,
				navbarDataNew: {
					showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
					navbarTitle: '', //导航栏 中间的标题
					isTopFixed: false,
					newLogo: uni.getStorageInfoSync('storeLogo'),
					hideHome: true
				},
				// https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Basket.png
				btnStatus: 0,
				fastTabNew: [{
						type: 'cart',
						icon: 'https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Basket.png?t=123',
						actIcon: 'https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Basket.png?t=123',
						title: '购物袋',
						path: '/pages/cart/cart',
						isAct: false,
						iconWidth: '64rpx'
					},
					{
						type: 'adviser',
						title: '顾问',
						isAct: false,
						iconWidth: '64rpx',
					}
				],
				isLove: {
					type: 'love',
					icon: 'https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Save.png',
					actIcon: 'https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Saved.png',
					title: '喜欢',
					isAct: false,
					iconWidth: '64rpx',
					authorizationRequired: true
				},
				ccJson: {},
				promotionJson: {},
				// 获取传过来的颜色
				totalQtyOut: -1,
				carousel: [],
				carouselArrId: [],
				colorName: '',
				productArr: [],
				markingPriceArr: [],
				productPickImg: '',
				sizeArr: [],
				sizeArrsortOrder: [],
				sizeName: '',
				productList: {},
				productColorList: {},
				markingPrice: '',
				price: '',
				priceString: false,
				colorIdx: 0,
				sizeIdx: -1,
				winHeight: '100%',
				goodsId: 0,
				valueId: 0,
				detail: {},
				isValidDate: true,
				frontCode: '',
				canOrder: true, //是否能下单
				purchasetype: 1, //1-正常购买;2-补货
				purchaseText: '立即预约',
				special: 0, ////0-正常入库;1-特价专区和换货专区,
				cartKey: '',
				skuLists: {},
				cartNum: getApp().globalData.cartNum,
				isIpx: false,
				isSystem: false,
				colorPriceJson: {
					colorList: []
				},
				showLoaded: true,
				showPriceDescription: false,
				ccStock: false,
				productSKU: '',
				categoryName: '',
				promotionArr: [],
				customPromotionArr: [],
				hasRule: false,
				rulesPrice: 0,
				maxPrice: '',
				itemName: '',
				itemCode: '',
				uData: '', // 商品描述
				ccDescriptionJson: {}, // cc级别商品描述集合
				showShare: false,
				shareImage: '',
				// 品牌信息 0：三仟院  1：ICH  2:PB
				brandType: getApp().globalData.brandType,
				// 是否展示视频的全局配置
				pdpShowVideoConfig: false,
				//轮播图自动
				registerType: null,
				enableArrivalNotice: false,
				arrivalBtnText: '',
				enableBuyNow: uni.getStorageSync('buyNow'),
				memberLevelId: 0,
				customerGroupId: 0,
				rulePriceJson: {},
				evaluateInfo: false,
				count: 5,
				parameterShow: false,
				paramsShow: false,
				chooseQty: 1,
				trackBrand: '',
				trackSeries: '',
				trackDegrees: '',
				identifier: 'cms/itemrecommend',
				ruleId: 'drawRule',
				disabledBtnText: "入会解锁购买权限",
				paramsJson: [{
						key: 'brand',
						title: '品牌',
						value: ''
					},
					{
						key: 'series',
						title: '系列',
						value: ''
					},
					{
						key: 'originPlace',
						title: '产地',
						value: ''
					},
					{
						key: 'netWeight',
						title: '净含量',
						value: ''
					},
					{
						key: 'storageMode',
						title: '储存方式',
						value: ''
					},
					{
						key: 'ingredient',
						title: '配料表',
						value: ''
					},
					{
						key: 'degrees',
						title: '酒精度',
						value: ''
					}
				],
				ispopupClick: '',
				barFixed: true,
				barHeight: "44",
				barTop: getApp().globalData.navBarHeight,
				barShow: false,
				iconShow: false,
				barId: "0",
				selectedIndex: 0,
				nextPages: '',
				detailHeight: "",
				tabList: [{
					text: "商品",
					navTarget: "#item1",
					iconClass: "icon01",
					iconImage: "",
					selectedIconClass: "",
					selectedIconImage: ""
				}, {
					text: "详情",
					navTarget: "#item3",
					iconClass: "icon03",
					iconImage: "",
					selectedIconClass: "",
					selectedIconImage: ""
				}, {
					text: "推荐",
					navTarget: "#item4",
					iconClass: "icon04",
					iconImage: "",
					selectedIconClass: "",
					selectedIconImage: ""
				}],
				tianYuType: -1,
				captchaTicket: '',
				limitSkuID: '',
				limitQty: 0,
				frontQty: 0,
				nowPages: '',
				activitySwitch: false,
				processTime: [{
					time: '3月30日10:00:00',
					name: '参与登记',
				}, {
					time: '3月30日10:00:00',
					name: '公布结果',
				}, {
					time: '3月30日10:00:00',
					name: '活动结束',
				}],
				activityStatus: 1, // 0未开始 1登记 2公布 3结束
				exTime: {},
				drawButtonText: '',
				remindSuccess: '',
				eve: api.environment,
				activityInfo: null,
				drawTipText: '',
				cutDown: false,
				cuttime: 0,
				cutAfterText: '',
				cutBeforeText: '',
				blackbg: true,
				fontname: 'font1',
				fromAddress: false,
				hasDrawInfo: false,
				drawEndTime: '',
				checkDialog: false,
				disableShare: false,
				isSpecial: false,
				trackPageName: '',
				//定义抽签购埋点时间格式
				drawStartTrackTime: '',
				promulgateTrackTime: '',
				activityEndTrackTime: '',
				exEndTrackTime: '',
				buyEndTrackTime: '',
				isLuckyDrawItem: false,
				// lucyCodeName: "",
				noticeText: false,
				bookState: '',
				levelName: '',
				drawTask: false,
				navText: '分享商品完成任务',
				taskContentId: '',
				taskCenterCode: '',
				taskContentName: '',
				drawRemainingTimes: 0, // 抽签次数
				showDrawCountDialog: false,
				countStatus: '', // 弹窗类型
				timers: [], // 抽签购倒计时合集
				orderFlowText: "立即购买",
				tsOrderInfo: {},
				tsActId: '',
				tsInfo: {},
				litha: false,
				lithaInfo: {},
				lithaGood: api.environment == 'trial' ? '88646' : '98690',
				from: 'default',
				intentChecked: false, // 意向登记
				intentSwitch: false,
				sharePosterPath: 'pages/item/categoryNew', // 默认商城页
				arrivalReminder: false, // 符合到货提醒按钮活动
				goodsOperateBtn: commonImages,
				title_EN: '',
				tagList: null,
				selectTagI: 0,
				showCartMsg: false,
				cartMessage: '',
				cartStatus: false,
				tipShow: false,
				recommendUtools: null,
				utoolsClassGoodsLists: null,
				goodsStatus: null,
				basicsTag: [],
				utoolsData: null,
				btnText: null,
				order: null,
				isDraw: false,
				isSpAo: false,
				activitySubscribeId: api.environment == 'trial' ? 193 : 527,
				isC2Bgoods: false,	//是否是 c2b定制商品
				isC2BgoodsIndex: -1,	//商品轮播第几个可以点击跳转
			};
		},
		components: {
			uParse: uParse,
			navBar: NavBar,
			onlineService: onlineService,
			itemRecommend: ItemRecommend,
			loading: Loading,
			luBarTabNav: luBarTabNav,
			progress: Progress,
			RrawDialog: RrawDialog,
			NoticeNav: NoticeNav,
			swiperComponent: SwiperComponent,
			swiperComponentNew: swiperComponentNew,
			tsComponent: TsComponent,
			tsComponentNew: TsComponentNew,
			registerWidget: registerWidget,
			FavDialog: FavDialog,
			intentDialog,
			failSubscribe,
			CartToast: CartToast
		},
		computed: {
			storeName() {
				return this.$store.state.storeName;
			},
			canBuy() {
				return this.btnStatus;
			},
			// btnText() {
			// 	let boolFlag = !!this.colorPriceJson[this.colorName] && !(this.colorPriceJson[this.colorName].sizePrice
			// 		.length == 1 && this.colorPriceJson[this.colorName].sizePrice[0].size == null);
			// 	if (!!this.ccJson[this.valueId]) {
			// 		// 已售罄
			// 		if (this.ccJson[this.valueId].frontQty <= 0 && this.ccJson[this.valueId].approveStatus == 'onsale') {
			// 			return 1;
			// 		}
			// 		// 加入购物袋
			// 		if (this.ccJson[this.valueId].approveStatus == 'onsale' && this.ccJson[this.valueId].frontQty > 0) {
			// 			return 3;
			// 		}
			// 		// 已下架
			// 		if (this.ccJson[this.valueId].approveStatus !== 'onsale') {
			// 			return 4;
			// 		}
			// 	}
			// },
			showIntent() {
				if (this.intentSwitch && (this.btnText == 4 || this.btnText == 1 || this.btnStatus !== 0)) {
					return true
				} else {
					return false
				}
			},
			productPurchaseType() {
				return !!this.isSpecial ? ['特殊'] : (!!this.isLuckyDrawItem || !!this.activitySwitch) ? ['抽签'] : ['常规']
			}
		},
		onPullDownRefresh() {
			this.getCartList();
			uni.stopPullDownRefresh();
		},
		async onShow(){
			let that = this
			let merchantInfo = uni.getStorageSync('merchantInfo');
			let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
			let systemInfo = uni.getSystemInfoSync();
			let isIpx = systemInfo.model.indexOf('iPhone X') !== -1 || systemInfo.model.indexOf('iPhone1') !== -1 ||
				systemInfo.model.indexOf('unknown<iPhone13') !== -1 || systemInfo.model.indexOf('iPhone 12/13') !== -1;
			this.isIpx = wx.getSystemInfoSync().system.includes('iOS') && wx.getSystemInfoSync()?.safeArea?.top >
				20; //isIpx;
			if (!!customerInfo) {
				that.$commonFunction.getCartList().then((res) => {
					that.cartNum = res.availableTotalQty
				}).catch((err) => {});
			}
			getApp().cl_tracker.track('mini_program_view', {
				path: this.nowPages,
				pageName: '商品详情',
			})
			if (this.fromAddress || this.hasDrawInfo) {
				this.getDrawInfo()
			}
			if (this.drawTask) {
				this.taskStatus()
			}

			if (!observer) {
				let h = wx.getSystemInfoSync().windowHeight / 2;
				let w = wx.getSystemInfoSync().windowWidth / 2
				setTimeout(() => {
					observer = wx.createIntersectionObserver(that, {
						observeAll: true,
						thresholds: [1]
					});

					observer.relativeToViewport({
						top: 150,
						bottom: 150,
						left: 0,
						right: 0
					}).observe('#utools-parse >>> .videos', (res) => {
						let dom = this.selectComponent(`#utools-parse >>> #${res.id}`)
						if (res.intersectionRatio === 1) {
							dom.onAppear()
						} else {
							dom.onDisappear()
						}
					})
				}, 3000)
			}
		},
		onPageScroll(e) { //nvue暂不支持滚动监听，可用bindingx代替
			this.barShow = e.scrollTop > 200
			try {
				this.$refs.barTabNav._selectedTab(e.scrollTop)
			} catch (e) {}

		},
		onLoad: async function(option = {}) {
			let that = this;
			await this.$onLaunched;
			this.detail = {};
			this.pdpShowVideoConfig = false;
			this.purchasetype = 1;
			this.isValidDate = true;
			this.canOrder = true;
			this.customerInfo = uni.getStorageSync(CUSTOMER_INFO) || {};
			this.cartKey = uni.getStorageSync(CART_KEY) || null;
			this.isSystem = getApp().globalData.isSystem;
			//接收上一个页面传过来的参数
			that.goodsId = option?.id;
			that.valueId = option?.valueId || 0
			this.utid = option?.utid

			if (option.scene) {
				await this.getScence(option.scene)
			}
			if (option.drawTask && option.drawTask == 'true') {
				this.drawTask = true
			}
			if (!!option.c_from) {
				this.from = option.c_from
			}
			if (option.tsActId) {
				// 从活动列表或订单列表过来
				this.tsActId = option?.tsActId
				this.tsOrderInfo = option?.tsOrderInfo ? JSON.parse(decodeURIComponent(option?.tsOrderInfo)) : {}
			}
			that.categoryName = option.categoryName;
			that.colorName = option.valueName || '';

			//太阳码进来的页面
			that.orderFlowText = this.$programSetting.openAppointment ? "立即预约" : "立即购买"

			this.enableBuyNow = uni.getStorageSync('buyNow')
			//家园系列活动页-点击预约产品埋点

			if (!!option["en"]) {
				getApp().cmsClTrack(option)
			}

			//购物袋
			if (uni.getStorageSync(CART_KEY) && uni.getStorageSync(CUSTOMER_INFO).customerId) {
				that.getCartList();
			}
			//会员信息
			that.getMemberDetail();
			//订阅
			if (this.goodsId == this.lithaGood) {
				this.lithaSubcirble()
			}
			//----获取公共参数
			await that.getCurrentMerchantInfo();
			let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
			let merchantInfo = uni.getStorageSync(MERCHANT_INFO);
			//----------
			//获取detail-bottom-top底部高度
			let query = uni.createSelectorQuery().in(this);
			query.selectAll('.detail-bottom-top').boundingClientRect();
			query.exec((res) => {
				this.detailHeight = res[0][0].height;
			});
			// 商品标签
			this.basicsTag = await this.getBasicsTag()

			let tag = await api.getItemTag({
				"itemId": that.goodsId
			})

			if (tag.success) {
				this.tagList = tag?.data ? tag.data : []
			}
			// 获取商品信
			await this.init();
			var pages = getCurrentPages();
			if (pages.length > 1 && !!pages[pages.length - 2]) {
				this.nextPages = pages[pages.length - 2].route;
			} else {
				this.trackPageName = '直接访问pdp'
			}
			//获取上一个页面
			var currPage = pages[pages.length - 1]; //当前页面
			this.nowPages = currPage.route;
			//埋点获取上一个页面名称
			if (this.nextPages == "pages/search/search") {
				this.trackPageName = '搜索'
			} else if (this.nextPages == "pages/cart/cart") {
				this.trackPageName = '购物袋'
			} else if (this.nextPages == "pages/order/list") {
				this.trackPageName = '订单列表'
			} else if (this.nextPages == "pages/order/details") {
				this.trackPageName = '订单详情'
			} else if (this.nextPages == "pages/item/categoryNew") {
				this.trackPageName = '酒窖'
			} else if (this.nextPages == "pages/home/home") {
				this.trackPageName = '首页'
			} else if (this.nextPages == "pages/info/info") {
				this.trackPageName = '我的'
			} else if (this.nextPages == "pages/item/search") {
				this.trackPageName = '列表页'
			}
			this.$EFSTracking.setCampagin(option.efs_campagin ? option.efs_campagin : '')
			if (uni.getStorageSync('commonEnable')) {
				let result = await getApp().getPdpEvaluate(option.id, false, false, true);
				if (result.code == 1000) {
					that.evaluateInfo = result.data;
					that.evaluateInfo.reviews.content.map(item => {
						item.createDate = item.createDate && item.createDate.split(' ')[0];
						if (!!item.reviewVideos && item.reviewVideos.length > 0) {
							item.reviewVideos = item.reviewVideos
						} else {
							item.reviewVideos = null
						}
					});

				}
			};

			if (!!option.bookproduct) {
				let nowTime = new Date().getTime()
				let startTime = new Date(option.startTime).getTime();

				let trackTime = this.trackDate(startTime)
				if (nowTime < startTime) {
					this.bookState = "预约未开放"
				} else {
					this.bookState = "预约已开始"
				}
				let clTrackPrams = {
					'c_book_start_time': trackTime,
					'c_book_state': this.bookState
				}
				getApp().commonClTrack('c_ebmp_homecollection_bookproduct_click', clTrackPrams)
			}
			if (option.hasExpose == 'true') {
				setTimeout(() => {
					that.$sr.track('trigger_sku_component', {
						"sku": {
							"sku_id": that.colorPriceJson[that.colorName]?.skuCode?.toString(),
							"sku_name": that.detail.itemName
						},
						"spu": {
							"spu_id": !!uni.getStorageSync('openOuterItemId') ? that.detail
								.outerItemId : !!uni
								.getStorageSync('youshuOpencc') ? that.detail.frontProperties[0]
								.frontCode?.toString() : that
								.detail.itemCode?.toString(),
							"spu_name": !!uni.getStorageSync('youshuOpencc') ? that.detail.itemName +
								that.detail
								.frontProperties?.[0].valueName : that.detail
								.itemName // 若商品无spu_name时，可传sku_name信息
						},
						"sku_category": [{
							"sku_cat_id": that.detail.categoryId?.toString(),
							"sku_cat_name": "11",
							"sku_parent_cat_id": "null" // 若已是顶级类目，传"null"
						}],
						"shipping_shop": {
							"shipping_shop_id": merchantInfo.cloudMerchantId + '', // 到家类型对接智慧零售入口必传
							"shipping_shop_name": "THE MACALLAN EBOUTIQUE麦卡伦" // 到家类型对接智慧零售入口必传
						},
						"sale": {
							"original_price": parseFloat(that.price), // 对接智慧零售入口必传
							"current_price": parseFloat(that.price) == 0 ? parseFloat(that
								.markingPrice) : parseFloat(that
								.price) // 对接智慧零售入口必传
						},
						"primary_image_url": that.carouselArrId?.[0]?.url.indexOf(".mp4") == -1 ? that
							.carouselArrId?.[0]
							.url : that.carouselArrId?.[1]?.url
						// more...
					})
				}, 4000)
			}

		},
		onUnload() {
			this.timers.map(item => {
				clearTimeout(item)
			})
			this.detail = {};
			this.pdpShowVideoConfig = false;
			this.purchasetype = 1;
			this.isValidDate = true;
			this.canOrder = true;
			this.sizeIdx == -1;
			this.showLoaded = true
			if (observer) observer.disconnect()
			observer = null
		},
		onHide() {
			if (observer) observer.disconnect()
			observer = null
		},
		methods: {
			/**
			 * 展示弱提示
			 * @param {Object} msg 文案
			 */
			handleShowTextToast(msg){
				try{
					this.$refs.toastPopup.showToast(msg);
				}catch(e){}
			},
			/**
			 * 若提示按钮点击回调
			 * @param {Object} data.type 类型：confirm确定，cancel取消
			 * @param {Object} data.callBackData 呼气弹窗时传入的数据
			 */
			onToastPopupClick(data){},
			//	查看个性化定制规则-不展示底部按钮
			handleToC2bPage(){
				if(this.isC2Bgoods){
					//	非会员 弹窗入会弹窗
					if(this.btnStatus === 1){
						this.$refs.registerWidgetRef.openJoinMemberModal();
						return;
					}
					// if (this.btnStatus === 2) {
					// 	return this.handleShowTextToast('请提升会员等级后购买');
					// }
					if(this.enableArrivalNotice && this.btnText == 1){
						if(this.arrivalBtnText == '到货提醒' || this.arrivalBtnText == '已设置开售提醒') {
							return this.handleShowTextToast('商品暂时缺货')
						};
					}
					uni.navigateTo({
						url: `/pages/item/goodsLetteringNew?itemId=${this.goodsId}&valueId=${this.valueId}`,
					})
				}else{
					this.handleShowTextToast('商品暂时缺货')
				}
			},
			//	腾讯有数埋点-browse_sku_page
			handleTrackSr(){
				try{
					let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
					const that = this;
					const youshuOpencc = uni.getStorageSync('youshuOpencc');
					const openOuterItemId = uni.getStorageSync('openOuterItemId');
					setTimeout(()=>{
						that.$commonSensors.pdpEvent('PDPView',that.detail, false, that.productPurchaseType, that.btnText == 1, this.drawButtonText == '立即购买')
						const spuid = !!openOuterItemId ? that.detail.outerItemId : !!youshuOpencc ? that.detail.frontProperties[0].frontCode + '' : that.detail.itemCode + '';
						const spuname = !!youshuOpencc ? that.detail.itemName + that.detail.frontProperties[0].valueName : that.detail.itemName;
						that.$sr.track('browse_sku_page', {
							"sku": {
								"sku_id": that.colorPriceJson[that.colorName]?.skuCode + '',
								"sku_name": that.detail.itemName
							},
							"spu": {
								"spu_id": spuid,
								"spu_name": spuname // 若商品无spu_name时，可传sku_name信息
							},
							"sku_category": [{
								"sku_cat_id": that.detail.categoryId + '',
								"sku_cat_name": "11",
								"sku_parent_cat_id": "null" // 若已是顶级类目，传"null"
							}],
							"shipping_shop": {
								"shipping_shop_id": merchantInfo.cloudMerchantId + '', // 到家类型对接智慧零售入口必传
								"shipping_shop_name": "THE MACALLAN EBOUTIQUE麦卡伦" // 到家类型对接智慧零售入口必传
							},
							"sale": {
								"original_price": parseFloat(that.price), // 对接智慧零售入口必传
								"current_price": parseFloat(that.price) == 0 ? parseFloat(that.markingPrice) : parseFloat(that.price) // 对接智慧零售入口必传
							},
							"primary_image_url": !!that.carouselArrId[0] && that.carouselArrId[0]?.url?.indexOf(".mp4") == -1 ?
								that.carouselArrId[0]?.url : that.carouselArrId?.[1]?.url
						})
					}, 4000);
				}catch(e){
					console.log("#########  handleTrackSr---error", e)
				}
			},
			setBtnText() {
				if (!!this.ccJson[this.valueId]) {
					// 已售罄
					if (this.ccJson[this.valueId].frontQty < 1 && this.ccJson[this.valueId].approveStatus == 'onsale') {
						return 1;
					}
					// 加入购物袋
					if (this.ccJson[this.valueId].approveStatus == 'onsale' && this.ccJson[this.valueId].frontQty > 0) {
						return 3;
					}
					// 已下架
					if (this.ccJson[this.valueId].approveStatus !== 'onsale') {
						return 4;
					}
					return 2
				}
			},
			async init() {
				this.goodsStatus = null
				this.colorPriceJson = {
					colorList: []
				};
				await this.getGoodsDetail();
				if(!this.isSpecial){
					// 普通商品触发曝光
					this.handleTrackSr();
				}
				
				this.utoolsData = await this.getHomeUtoolsData()
				this.recommendUtools = await this.handleUtoolsRecommend()
				this.btnText = this.setBtnText()

				if (this.goodsId && this.valueId) {
					this.handleSaveRecentBrowsing({
						"itemId": this.goodsId,
						"valueId": this.valueId
					})
				}
				if (this.recommendUtools) {
					//商品
					this.utoolsClassGoodsLists = await this.getCateGoods(this.recommendUtools?.classId || 8066)
					this.exposeSkuTrack(this.utoolsClassGoodsLists)
				}
				let d = this.ccJson[this.valueId]

				if (d.approveStatus == 'instock') {
					this.goodsStatus = 1
					return 'ok'
				}
				if (this.intentSwitch) {
					this.goodsStatus = 2
					return 'ok'
				}
				if (this.ccJson[this.valueId].frontQty < 6) {
					this.goodsStatus = this.ccJson[this.valueId].frontQty < 1 ? 3 : 4
					return 'ok'
				}

				return null
			},
			//商品曝光expose_sku
			exposeSkuTrack(cateProductList) {
				let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
				for (let i = 0; i < cateProductList.length; i++) {
					if (cateProductList[i].skuCodes !== undefined) {
						this.$sr.track('expose_sku_component', {
							sku: {
								sku_id: cateProductList[i].skuCodes[0].toString(),
								sku_name: cateProductList[i].itemName // 若商品无sku_name时，可传spu_name信息
							},
							spu: {
								spu_id: !!uni.getStorageSync('openOuterItemId') ? cateProductList[i].outerItemId :
									!
									!uni.getStorageSync('youshuOpencc') ? cateProductList[i].frontCode
									.toString() : cateProductList[i].itemCode.toString(),
								spu_name: !!uni.getStorageSync('youshuOpencc') ? cateProductList[i].itemName +
									cateProductList[i].valueName : cateProductList[i]
									.itemName // 若商品无spu_name时，可传sku_name信息
							},
							sku_category: [{
								sku_cat_id: cateProductList[i].categoryId.toString(),
								sku_cat_name: '全部商品',
								sku_parent_cat_id: 'null' // 若已是顶级类目，传"null"
							}],
							"shipping_shop": {
								"shipping_shop_id": merchantInfo.cloudMerchantId.toString(), // 到家类型对接智慧零售入口必传
								"shipping_shop_name": "THE MACALLAN EBOUTIQUE麦卡伦" // 到家类型对接智慧零售入口必传
							},
							sale: {
								original_price: parseFloat(cateProductList[i].price), // 对接智慧零售入口必传
								current_price: parseFloat(cateProductList[i].price) // 对接智慧零售入口必传
							},
							primary_image_url: cateProductList[i].majorUrl
						});
					}
				}
			},
			//  查询首页商品分类列表
			async getCateGoods(class_id, is_sort) {
				try {
					//获取商品
					let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
					let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
					let res = await this.$commonFunction.doSearchGoods(class_id, '', 1, 200, null, '', is_sort, '', '',
						'', '')
					let cateProductList = res.data.content; // 商品列表
					//sku实时库存查询
					let skuCodeList = [],
						goodsQ = [];
					for (let i = 0; i < cateProductList.length; i++) {
						skuCodeList = skuCodeList.concat(cateProductList[i].skuCodes)
					}

					if (skuCodeList.length) {
						skuCodeList = await this.setSkuCodeList(skuCodeList)
						for (let i = 0; i < skuCodeList.length; i++) {
							let reset = await this.getAvailableBatchQty(customerInfo, merchantInfo, skuCodeList[i]);
							goodsQ = reset.length ? goodsQ.concat(reset) : goodsQ
						}
					}

					// 策略价格
					let list = [];
					cateProductList = cateProductList.map(async item => {
						let res = await this.$commonFunction.priceRulesDeal(item.strategies, item
							.itemmCode)
						if (goodsQ && goodsQ.length) {
							for (let i = 0; i < goodsQ.length; i++) {
								if (item.skuCodes.indexOf(goodsQ[i].skuCode) !== -1 && goodsQ[i]
									.availableQty > 0) {
									item.frontQty += goodsQ[i].availableQty
								}
							}
						}
						if (res.price !== 0) {
							if (item.itemCode == res.itemCode) {
								item.price = res.price
							}
						}
						if (res.rulesArr.length > 0) {
							if (item.itemCode == res.itemCode) {
								item.rulesArr = res.rulesArr
							}
						}
						// var isForwardpurchaseGoods = false;
						// let  customPromotionTags = item['promotionTagList']?.map(ite=>{
						// 	if (ite.promotionType == 'custom_tag') {
						// 	  customPromotionTags.push(tagItem);
						// 	}

						// 	if (tagItem.promotionType == 'forward_purchase') {
						// 	  isForwardpurchaseGoods = true;
						// 	}
						// 	return ite.promotionType == 'custom_tag'? ite : null
						// })
						list.push(item)
						return item
					})
					return list
				} catch (err) {
					return null
				}
			},
			async setSkuCodeList(skuCodeList) {
				if (skuCodeList.length < 21) {
					return [skuCodeList]
				} else {
					const result = skuCodeList.flatMap((value, index, array) => {
						if (index % 20 === 0) {
							return [array.slice(index, index + 20)];
						}
						return [];
					});
					return result
				}
			},
			async getAvailableBatchQty(customerInfo, merchantInfo, skuCodeList) {

				let reset = await api.getAvailableBatchQty({
					method: "POST",
					header: {
						'jwt': customerInfo.jwt,
						'content-type': 'application/json'
					},
					// query: JSON.stringify(skuCodeList)
					query: skuCodeList
				}, merchantInfo.cloudMerchantId);
				if (reset.msg == "SUCCESS" && reset?.data?.length) {
					return reset.data.filter(item => item.availableQty > 0)
				} else {
					return []
				}
			},
			onAddCart(e) {
				const {
					data
				} = e.detail
				this.goods = data
				this.addCart(e)
			},
			// 商品加入购物车功能
			async addCart(e) {
				try {
					const {
						data
					} = e.detail
					this.goodsId = data.itemId
					let that = this
					let merchantInfo = uni.getStorageSync('merchantInfo');
					let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
					let userInfo = uni.getStorageSync(USER_INFO);
					if (!customerInfo && !userInfo) {
						that.registerType = 'cart';
						that.getUserProfile();
						return false;
					} else if (!customerInfo && !!userInfo) {
						that.registerType = 'cart';
						that.$refs.registerWidgetRef.openJoinMemberModal()
						return false;
					}
					let goodsInfo = await this.goodsInfo
					if (!goodsInfo || goodsInfo.code != 1000) return this.handleCartToast({
						success: false,
						msg: "加入购物车失败"
					});
					// 加入购物车
					const cartRes = await this.$commonFunction.buildProductsAddCart({
						price: goodsInfo.data.skus[0].price,
						itemId: goodsInfo.data.itemId,
						valueId: goodsInfo.data.frontProperties[0].valueId,
						itemCode: goodsInfo.data.itemId,
						itemName: goodsInfo.data.itemName,
						qty: 1,
						skuCode: goodsInfo.data.skus[0].skuCode,
						skuId: goodsInfo.data.skus[0].skuId,
					});
					//  加入购物车提示
					this.handleCartToast(cartRes);
				} catch (e) {
					this.handleCartToast({
						success: false,
						msg: "加入购物车失败"
					});
				}
			},
			/**
			 *  为你推荐utools数据
			 */
			async handleUtoolsRecommend(option) {
				let json = await api.getUtoolsJson({
					type: 'cartRecommend'
				});
				return json.success && json?.data ? JSON.parse(json.data) : null
			},
			async selectTag(i) {
				wx.showLoading()

				let tag = this.tagList[i]
				this.selectTagI = i;
				this.goodsId = tag?.itemId;
				this.valueId = tag?.valueId;
				await this.init()
				this.$refs.swiperRef.currentIndex = 0
				wx.hideLoading()
			},
			async getHomeUtoolsData() {

				let json;
				if (this.utid) {
					json = await api.getUtoolsJsonP({
						utoolsId: this.utid,
						type: 'item_value'
					});
				} else {
					json = await api.getUtoolsJsonByRelevance({
						relevance: this.goodsId,
						type: 'item_value'
					});
				}
				return json.success && json?.data ? JSON.parse(json.data) : null
			},
			async getBasicsTag() {
				let tag = await api.getBasicsTag({
					key: 'item_status_label'
				});
				let arr = tag?.data?.value ? JSON.parse(tag?.data?.value) : []
				// arr.sort((a,b)=>  a?.status-b?.status )
				return arr
			},
			onTriggerComponent(e) {
				try {
					let {
						itemId,
						type = null,
						trackData = null,
						item = null
					} = e.detail.data;
					if (type == 'anchorsClick') {
						if (itemId == 'tip') {
							this.tipShowFunction()
						}
						if (itemId == 'params') {
							this.paramsShowFunction()
						}
					}else if(type == 'c2bClick'){
						//	跳转c2b刻字页面
						return this.handleToC2bPage();
					}
					this.$commonUtoolsTrack.onTriggerComponent(e);
				} catch (e) {
					console.log("home-onTriggerComponent-error:", e)
				}
			},


			//  购物袋最近浏览-存储用户浏览商品数据
			async handleSaveRecentBrowsing(data) {
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				if (!customerInfo || !customerInfo?.openId) return;
				let merchantInfo = uni.getStorageSync('merchantInfo') || (await getApp().getMerchantInfo());
				await api.saveRecentBrowsing({
					method: "POST",
					query: {
						"itemId": data.itemId,
						"records": JSON.stringify(data)
					}
				}, customerInfo.openId);
			},
			//意向登记
			async intentHandle(from) {
				if (!uni.getStorageSync(CUSTOMER_INFO).jwt) {
					this.registerType = 'addIntent'
					this.getUserProfile()
				} else {
					let res;
					if (!this.intentChecked) {
						this.commonTrack('c_ebmp_product_click_notice_me', {})
						res = await setFav(this.detail, 'add', this.valueId, 1)
						if (this.litha) {
							await this.lithaSubcirble()
						}
						if (this.arrivalReminder) {
							await this.getArrivalStatus()
						}
						try {
							this.$refs.intentRef.open(this.canBuy, this.btnText, this.arrivalBtnText, this.litha, this.isLove.isAct)
						} catch (e) {
						}

					} else {
						if (from == 'modal') {
							res = await setFav(this.detail, 'cancel', this.valueId, 1)
							this.commonTrack('c_ebmp_product_cancel_notice_me_result', {
								c_result: '取消登记'
							})
							this.$commonSensors.pdpEvent('PDPClick', this.detail, '取消登记', this.productPurchaseType,
								this.btnText == 1, this.drawButtonText == '立即购买')
						} else {
							this.commonTrack('c_ebmp_product_cancel_notice_me', {})
							this.$refs.intentRef.confrim()
							return
						}
					}
					if (res.status) {
						if (res.operateType == 'add') {
							this.$commonSensors.pdpEvent('PDPClick', this.detail, '立即登记', this.productPurchaseType,
								this.btnText == 1, this.drawButtonText == '立即购买')
							this.intentChecked = true
							if (!this.isLove.isAct) {
								this.fastTabClick(this.isLove, 1, 'intent')
							}
						} else {
							this.intentChecked = false
						}
					}
				}
			},
			// 公共埋点
			commonTrack(eventName, params, type) {
				const clTrackPram = {
					'c_product_name': this.detail.itemName,
					'c_product_brand': this.trackBrand,
					'c_product_price': this.price,
					'c_product_year': '',
					'c_product_series': this.trackSeries,
					'c_product_scenarios': (!!this.isLuckyDrawItem || !!this.activitySwitch) ? '不凡甄品' : '',
					'c_product_taste': '',
					'c_product_alcoholconcentration': this.trackDegrees,
					'c_product_volume': this.ccJson[this.valueId].valueName,
					'c_product_id': this.detail.itemId,
					'c_order_type': !!this.isSpecial ? '会员活动' : (!!this.isLuckyDrawItem || !!this.activitySwitch) ?
						'抽签购买' : '常规购买',
					'c_purchase_type': !!this.$programSetting.openAppointment ? '预约购买' : ((this.tsInfo && this.tsInfo
						.selectionEnabled) || this.tsOrderInfo?.isTsDraw) ? '立即购买（抽签）' : '立即购买',
					'c_campaignID': !!this.isSpecial ? (this.tsInfo.campaignTargetSaleId || this.tsActId) : '',
					'c_campaignName': !!this.isSpecial ? (this.tsInfo.name || this.tsOrderInfo.tsName) : '',
					'c_campaighStatus': !!this.isSpecial ? this.$refs.tsRef.getTrackStatus() : '',
					'c_product_state': this.btnText === 1 ? '售罄' : this.btnText == 3 ? '正常' : this.btnText == 4 ?
						'下架' : ''
				}
				let clTrackPrams = Object.assign(clTrackPram, params)
				if (type == 1) {
					//litha微分析上报
					wx.reportEvent(eventName, {
						"eventdata": JSON.stringify(clTrackPrams)
					})
				} else {
					getApp().commonClTrack(eventName, clTrackPrams)
				}
				if (eventName == 'c_ebmp_target_sales_draws_register_to_draws') {
					this.$commonSensors.pdpEvent('PDPClick', this.detail, '立即登记', this.productPurchaseType, this.btnText ==
						1,
						this.drawButtonText == '立即购买')
				} else if (eventName == 'c_ebmp_wish_list_remove_from_wish_list' || eventName ==
					'c_ebmp_wish_list_add_to_wish_list') {
					this.$commonSensors.pdpEvent('PDPClick', this.detail, eventName ==
						'c_ebmp_wish_list_add_to_wish_list' ? '喜欢' : '取消喜欢', this.productPurchaseType, this.btnText ==
						1, this.drawButtonText == '立即购买')
				}
			},
			drawCommonTrack() {
				let drawCommonTrackParams = {
					'c_from': this.nextPages + this.trackPageName,
					'c_draw_campaign_id': this.activityInfo.activitySelectionId,
					'c_draw_campaign_name': this.activityInfo.activitySelectionName,
					'c_campaign_time_register': this.drawStartTrackTime,
					'c_campaign_time_announce': this.promulgateTrackTime,
					'c_campaign_time_end': this.activityEndTrackTime,
					'c_level_when_join': this.levelName,
					'c_group_id': this.activityInfo.remark,
					'c_skuid': this.activityInfo.skuId,
					'c_campaign_time_register_end': this.exEndTrackTime,
					'c_campaign_time_announce_end': this.buyEndTrackTime,
				}
				return drawCommonTrackParams
			},
			// 获取自定义参数
			getScence: async function(key) {
				const sence = await api.getScence({
						method: 'GET',
					},
					key,
				)
				if (sence.code === 1000) {
					let value = JSON.parse(sence.data.value)
					this.goodsId = value.id;
					this.valueId = value.valueId;
				}
			},
			// 查询litha订阅记录
			async lithaSubcirble() {
				let startTime = new Date('2023/11/01 23:59:59').getTime()
				let endTime = new Date('2023/11/15 23:59:59').getTime()
				let nowTime = await this.$commonFunction.getServerTime()
				this.lithaInfo.subscrible = api.environment == 'trial' ? 138 : 218
				if (nowTime > startTime && nowTime < endTime) {
					this.litha = true
					let subscribeStatus = await getSubscribeStatus(this.lithaInfo.subscrible)
					if (!subscribeStatus) {
						// '商品上新通知'
						this.lithaInfo.lithaButtonStatus = false
						let {
							templateId,
							activitySubscribeName
						} = await getActivitySubscribeTemplate(this.lithaInfo.subscrible)
						this.lithaInfo.template = new Array(templateId)
						this.lithaInfo.activitySubscribeName = activitySubscribeName
					} else {
						// '已设置开售提醒'
						this.lithaInfo.lithaButtonStatus = true
					}
					this.timers.push(setTimeout(() => {
						this.litha = false
					}, (endTime - nowTime)))
				} else {
					this.litha = false
				}
			},
			lithaBook(type) {
				let that = this
				this.commonTrack('c_ebmp_product_click_new_arrival_notice', {})
				let trackParams = {
					'c_miniprogram_template_name': this.lithaInfo.activitySubscribeName,
					'c_miniprogram_template_id': this.lithaInfo.template[0],
					'c_subscription_result': ''
				}
				if (!this.lithaInfo.lithaButtonStatus) {
					let template = this.lithaInfo.template[0]
					that.$commonSensors.popupEvent('PopupExposure', {
						'popup_type': '订阅消息',
						'popup_name': '订阅消息弹窗'
					})
					that.$commonSensors.modelAuthAsk('活动', this.lithaInfo.template)
					uni.requestSubscribeMessage({
						tmplIds: this.lithaInfo.template,
						success(res) {
							if (res[template] == "accept") {
								// 用户允许接收订阅消息
								doSubscribe(that.lithaInfo.subscrible).then((res) => {
									that.lithaInfo.lithaButtonStatus = true
									that.handleShowTextToast('订阅成功')
									that.$forceUpdate()
								})
								trackParams.c_subscription_result = '成功'
								that.$commonSensors.popupEvent('PopupClick', {
									'popup_type': '订阅消息',
									'popup_name': '订阅消息弹窗',
									'button_name': '允许'
								})
							} else {
								that.$refs.failSubRef.open()
								trackParams.c_subscription_result = '取消'
								that.$commonSensors.popupEvent('PopupClick', {
									'popup_type': '订阅消息',
									'popup_name': '订阅消息弹窗',
									'button_name': '拒绝'
								})
							}
							that.commonTrack('c_ebmp_subscribe_miniprogram_notification', trackParams)
						},
						fail(res) {},
						complete(res) {
							if (type == 'intent') {
								that.$refs.intentRef.closeModal()
							}
						}
					});
				}
			},
			// ts选择弹窗设置选择数量
			setChooseQty(val) {
				this.chooseQty = val
			},
			setTsInfo(obj) {
				// ts限购标签
				this.tsInfo = obj
			},
			//	ts商品发送曝光埋点
			youshuTrack(){
				this.handleTrackSr();
			},
			buySepecial() {
				// 0 加入购物袋(cart) 1立即购买(buynow) 2抽签购(buyDraw) 3ts(buySpecial)
				this.registerType = 'buySpecial'
				this.$refs.tsRef.buyItNow()
			},

			shareTrack(clShareParams) {
				if (this.taskCenterCode) {
					getApp().commonClTrack("c_ebmp_drawstask_product_share", clShareParams);
				}
			},
			// 任务完成状态
			async taskStatus() {
				let info = await getApp().getTaskInfo()
				if (info) {
					let list = info.contentList[0].content
					this.taskCenterCode = info.contentList[0].taskCenterCode
					list.map(item => {
						if (item.taskContentType == 'SharePage') {
							this.taskContentId = item.taskContentId
							this.taskContentName = item.taskContentName
							if (item.taskContentStatus > 3) {
								this.navText = '任务已完成'
							} else {
								this.navText = '分享商品完成任务'
							}
						}
					})
				}
			},
			async drawHandle() {
				let val = this.drawButtonText
				if (val == "回到首页") {
					uni.reLaunch({
						url: '/pages/home/home'
					})
				} else if (val == '查看订单') {
					uni.navigateTo({
						url: '/pages/order/list'
					})
				} else if (val == '立即购买') {
					this.buyItNow('buyDraw', 4)
				} else if (val == '立即登记') {
					//抽签购-立即登记埋点
					this.commonTrack('c_ebmp_draws_join', this.drawCommonTrack())
					// 查看抽签次数
					if (this.activityInfo.inTask) {
						this.$commonFunction.setInitTaskCenter().then(() => {
							this.getTaskDeafultCount()
						}).catch(() => {
							this.getTaskDeafultCount()
						})
					} else {
						this.showRuleDialog()
					}

				} else if (val == '入会解锁购买权限') {
					this.getUserProfile()
				} else if (val == '开售提醒') {
					this.remindRequest()
				} else if (val.includes('升级至')) {
					//弹框
					this.isNewRuleShow = true
				} else if (val == '待支付') {
					uni.navigateTo({
						url: '/pages/order/details?orderNo=' + this.order.orderId
					})
				}
			},
			goToRule() {
				uni.navigateTo({
					url: '/pages/customer/memberRules'
				})
			},
			//查看任务中心抽签次数
			async getDrawCountInfo() {
				let info = await getApp().getTaskInfo()
				this.drawRemainingTimes = info.drawRemainingTimes
				if (!info.contentList && this.drawRemainingTimes == 0) {
					this.countStatus = 0
					this.showDrawCountDialog = true
					return false
				}
				let list = info.contentList && info.contentList[0].content
				let taskList = list && list.filter(item => item.taskContentStatus < 4)
				if (this.drawRemainingTimes > 0) {
					this.showRuleDialog()
					return false
				}
				if (this.drawRemainingTimes == 0 && taskList.length > 0) {
					this.countStatus = 1
				}
				if (this.drawRemainingTimes == 0 && taskList.length == 0 && list.length > 0) {
					this.countStatus = 3
				}
				this.showDrawCountDialog = true
			},
			// 查看默认任务次数
			async getTaskDeafultCount() {
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let json = await api.getTaskDeafultCount({
					method: 'GET',
					header: {
						jwt: customerInfo.jwt
					}
				})
				if (json.code == 1000) {
					let defaultCount = json.data
					if (defaultCount > 0) {
						this.showRuleDialog()
					} else {
						this.getDrawCountInfo()
					}
				} else {
					this.getDrawCountInfo()
				}
			},
			closeDrawCountDialog() {
				this.showDrawCountDialog = false
			},
			// 抽签规则弹窗
			showRuleDialog() {
				// this.checkDialog = true
				this.checkIn()
				// this.$commonSensors.popupEvent('PopupExposure', {
				// 	'popup_type': '购买',
				// 	'popup_name': '立即登记登记弹窗'
				// })
			},
			// 本次活动仅限受邀用户参与
			async verifyDrawIdentify(activityInfo) {
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let json = await api.verifyDrawIdentify({
					method: 'POST',
					header: {
						jwt: customerInfo ? customerInfo.jwt : ''
					},
				}, activityInfo.activitySelectionId)
				if (json.code !== 1000) {
					this.handleShowTextToast(json.msg)
					uni.navigateBack({
						delta: -1
					})
				}
			},
			async getDrawInfo() {
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || getApp().globalData.merchantInfo;

				let json = await api.getDrawInfo({
					method: 'GET',
					query: {
						store_id: merchantInfo.cloudMerchantStoreId,
						merchant_id: merchantInfo.cloudMerchantId,
						customer_id: customerInfo ? customerInfo.customerId : '',
						item_id: this.goodsId,
						value_id: this.valueId
					}
				})
				if (json.code === 1000) {
					this.activitySwitch = true
					let data = json.data;
					if (!!customerInfo) {
						this.verifyDrawIdentify(data)
					}
					this.ruleId = data.activitySelectionDesc || 'drawRule'

					let systemInfo = uni.getStorageSync(SYSTEM_INFO);
					let createTime = data.createTime
					let drawStartTime = data.activitySelectionStartTime
					let drawEndTime = data.activitySelectionEndTime
					let promulgateTime = data.promulgateTime
					let activityEndTime = data.buyEndTime
					let activityStopTime = data.activityStopTime
					this.processTime[0].time = this.formatDate(drawStartTime)
					this.processTime[1].time = this.formatDate(promulgateTime)
					this.processTime[2].time = this.formatDate(activityEndTime)
					this.drawEndTime = this.formatDate(drawEndTime)
					let exCreateTime, exStartTime, exEndTime, expromulgateTime, buyEndTime;
					exCreateTime = createTime && util.formatTimeStamp(createTime);
					exStartTime = drawStartTime && util.formatTimeStamp(drawStartTime);
					expromulgateTime = promulgateTime && util.formatTimeStamp(promulgateTime);
					exEndTime = drawEndTime && util.formatTimeStamp(drawEndTime);
					buyEndTime = activityEndTime && util.formatTimeStamp(activityEndTime);
					activityStopTime = activityStopTime && util.formatTimeStamp(activityStopTime);
					this.exTime.exCreateTime = exCreateTime
					this.exTime.exStartTime = exStartTime
					this.exTime.expromulgateTime = expromulgateTime
					this.exTime.exEndTime = exEndTime
					this.exTime.buyEndTime = buyEndTime
					this.exTime.activityStopTime = activityStopTime
					this.drawStartTrackTime = this.trackDate(exStartTime)
					this.promulgateTrackTime = this.trackDate(expromulgateTime)
					this.activityEndTrackTime = this.trackDate(buyEndTime)
					this.exEndTrackTime = this.trackDate(exEndTime)
					this.buyEndTrackTime = this.trackDate(buyEndTime)
					this.activityInfo = data
					this.order = await this.getOrder(exCreateTime)
					this.statusChange()
				} else {
					// this.activitySwitch = false
					setTimeout(() => {
						this.showLoaded = false
					}, 500);
					if (!!this.isLuckyDrawItem) {
						this.activityInfo = null;
						this.cutDown = false;
						this.blackbg = false
						this.dlTextBoxBgColor = "#000"
						this.drawButtonText = '活动已结束'
						this.order = await this.getOrder()
						this.drawTipText = ''
						if (this.order && this.order?.status == 'TRADE_CLOSED_BY_CLOUD') {
							this.drawTipText = '支付超时，未完成支付'

						}
						// this.drawTipText = '活动已结束，期待您下次参与'
					}
				}

			},

			async statusChange() {
				await this.getMemberDetail()
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let nowTime = new Date().getTime()
				let cuttime;
				let endtime;
				let activityStatus;
				this.cutDown = false
				this.remindSuccess = false

				// -1不满足活动资格
				let level = this.activityInfo.memberLevelJson.indexOf(this.memberLevelId)
				//活动未开始
				if (nowTime < this.exTime.exStartTime) {
					// endtime = this.exTime.exStartTime
					this.activityStatus = 0
					// this.cutDown = true;
					// this.cutBeforeText = '活动将在'
					// this.cutAfterText = '后开始'
					let remindSuccess = await this.isSecondRemindRquest()
					if (remindSuccess) {
						this.blackbg = false
						// this.drawButtonText = '已设置提醒'
						this.drawButtonText = '已设置开售提醒'
					} else {
						this.blackbg = true
						// this.drawButtonText = '提醒我'
						this.drawButtonText = '开售提醒'
					}
					this.remindSuccess = remindSuccess
					this.setTimeOver(this.exTime.exStartTime, nowTime)
				}
				//登记时间
				if (nowTime > this.exTime.exStartTime && nowTime < this.exTime.exEndTime) {
					if (this.activityInfo.activitySelectionRecord) {
						endtime = this.exTime.expromulgateTime
					} else {
						endtime = this.exTime.exEndTime
					}
					this.activityStatus = 1
					this.setTimeOver(this.exTime.exEndTime, nowTime)
				}
				//登记时间结束--公布时间
				if (nowTime > this.exTime.exEndTime && nowTime < this.exTime.expromulgateTime) {
					endtime = this.exTime.expromulgateTime
					this.activityStatus = 2
					// this.blackbg = false
					// this.drawButtonText = '登记已结束'
					this.setTimeOver(this.exTime.expromulgateTime, nowTime)
				}
				//公布时间---购买结束时间
				if (nowTime > this.exTime.expromulgateTime && nowTime < this.exTime.buyEndTime) {
					this.activityStatus = 3
					this.blackbg = false
					// this.drawButtonText = '登记已结束'
					// this.drawTipText = ''
					this.setTimeOver(this.exTime.buyEndTime, nowTime)
				}
				this.isShow = true
				setTimeout(() => {
					this.showLoaded = false;
				}, 500)

				// if (nowTime > this.exTime.expromulgateTime) {
				// 	if (this.activityInfo.activitySelectionRecord && this.activityInfo.activitySelectionRecord
				// 		.luckyCode) {
				// 		this.lucyCodeName = this.detail.newitemName +
				// 			`${this.activityInfo.activitySelectionRecord.luckyCode}`
				// 	}
				// }
				if (nowTime > this.exTime.buyEndTime) {
					this.timers.map(item => {
						clearTimeout(item)
					})
					this.end()
					this.activityStatus = 4
					this.blackbg = false
					this.drawButtonText = '活动已结束'
					this.drawTipText = ''
					// return false
				}
				// //活动结束之后
				// if (nowTime > this.exTime.activityStopTime) {
				// 	if (!!this.isLuckyDrawItem) {
				// 		this.activityStatus = 4
				// 		this.blackbg = false
				// 		this.drawButtonText = '活动已结束'
				// 		this.drawTipText = ''

				// 		// this.getDrawInfo()
				// 	}
				// 	this.activitySwitch = false
				// 	return false
				// }
				this.cuttime = (endtime - nowTime) / 1000
				if (!!customerInfo == false) {
					this.drawButtonText = '入会解锁购买权限'
					this.drawTipText = ''
					this.blackbg = true
				}
				if (!!customerInfo) {
					// 会员且不满足资格
					if (level == -1) {
						if (api.environment == 'formal') {
							if (this.activityInfo.memberLevelJson.indexOf(24) !== -1) {
								this.drawButtonText = '升级至V2尊享会员解锁登记权限'
							} else if (this.activityInfo.memberLevelJson.indexOf(24) !== -1 && this.activityInfo
								.memberLevelJson.indexOf(25) !== -1) {
								this.drawButtonText = '升级至V2/V3尊享会员解锁登记权限'
							} else if (this.activityInfo.memberLevelJson.indexOf(25) !== -1) {
								this.drawButtonText = '升级至V3尊享会员解锁登记权限'
							}
						} else if (api.environment == 'trial') {
							if (this.activityInfo.memberLevelJson.indexOf(32) !== -1) {
								this.drawButtonText = '升级至V2尊享会员解锁登记权限'
							} else if (this.activityInfo.memberLevelJson.indexOf(32) !== -1 && this.activityInfo
								.memberLevelJson.indexOf(33) !== -1) {
								this.drawButtonText = '升级至V2/V3尊享会员解锁登记权限'
							} else if (this.activityInfo.memberLevelJson.indexOf(33) !== -1) {
								this.drawButtonText = '升级至V3尊享会员解锁登记权限'
							}
						}
						this.blackbg = false
						this.drawTipText = ''
						return false
					}

					//参与登记状态 包含 可登记和不可登记时间段
					if (this.activityStatus == 1) {
						if (!this.activityInfo.activitySelectionRecord) {
							// this.cutDown = true
							// this.cutBeforeText = '本次活动登记将在'
							// this.cutAfterText = '后截止'
							this.blackbg = true
							this.drawButtonText = '立即登记'
						} else {
							// this.cutDown = true
							// this.cutBeforeText = '活动将于'
							// this.cutAfterText = '公布结果'
							let time = this.getFormatDate(this.exTime.expromulgateTime)
							this.drawTipText = '活动将于' + time + '公布结果'
							this.dlTextBoxBgColor = "#000000"
							this.drawButtonText = '等待公布结果'
							this.blackbg = false

							//没有登记展示等级已结束
						}
					}

					//参与登记状态 包含 可登记和不可登记时间段
					if (this.activityStatus == 2) {
						if (!this.activityInfo.activitySelectionRecord) {
							// this.cutDown = true
							// this.cutBeforeText = '本次活动登记将在'
							// this.cutAfterText = '后截止'
							// this.blackbg = true
							this.dlTextBoxBgColor = "#000"
							this.drawButtonText = '登记已结束'
							this.blackbg = false
						} else {
							// this.cutDown = true
							// this.cutBeforeText = '活动将于'
							// this.cutAfterText = '公布结果'
							this.drawTipText = ''
							this.drawButtonText = '等待公布结果'
							this.blackbg = false

							//没有登记展示等级已结束
						}

					}
					//公布结果状态
					if (this.activityStatus == 3) {
						if (this.activityInfo.activitySelectionRecord) {
							//默认状态兼容其他状态签
							this.blackbg = true
							// this.drawTipText = '很遗憾，本次活动未获得购买资格'
							if (this.activityInfo.activitySelectionRecord.activitySelectionRecordStatus == 1 || this
								.activityInfo.activitySelectionRecord.activitySelectionRecordStatus == 2) {
								this.fontname = 'font2'
								this.drawTipText = ''
								this.drawButtonText = '未中签'
								this.blackbg = false
							} else if (this.activityInfo.activitySelectionRecord.activitySelectionRecordStatus == 3) {
								this.dlTextBoxBgColor = "#CB171A"
								this.drawButtonText = '立即购买'
								this.drawTipText = '恭喜您成功获得购买权限'
								nowTime = new Date().getTime()
								this.start(this.exTime.buyEndTime - nowTime)

								// 倒计时时间
							} else if (this.order && (this.order?.status == 'WAIT_BUYER_PAY' || this.order?.status ==
									'BUYER_PART_PAYMENT' || this.order?.status == 'TRADE_CLOSED_BY_CLOUD')) {
								nowTime = new Date().getTime()
								let endTime = util.formatTimeStamp(this.order.planEndTime)
								if (nowTime > endTime || this.order?.status == 'TRADE_CLOSED_BY_CLOUD') {
									this.end()
									this.drawButtonText = '查看订单'
									this.dlTextBoxBgColor = "#000"
									this.drawTipText = '支付超时，未完成支付'
								} else {
									this.drawButtonText = '待支付'
									this.dlTextBoxBgColor = "#CB171A"
									this.drawTipText = '恭喜您成功获得购买权限'
									this.start(endTime - nowTime)
									this.setTimeOver(endTime, nowTime)
								}
							} else if (this.activityInfo.activitySelectionRecord.activitySelectionRecordStatus == 5) {
								this.end()
								this.drawButtonText = '查看订单'
								this.dlTextBoxBgColor = "#CB171A"
								this.drawTipText = '您已成功参与本次活动'
								if (this.order?.refundStatus == 'HAVE_REFUND' && this.order?.items[0]?.refundStatus == "SUCCESS") {
									this.drawButtonText = '查看订单'
									this.drawTipText = '您的订单已退款成功'
									this.dlTextBoxBgColor = "background-color: #000"
								}
							} else {
								this.blackbg = false
								this.drawButtonText = '登记已结束'
								this.drawTipText = ''
							}
						} else {
							this.blackbg = false
							this.drawButtonText = '登记已结束'
							this.drawTipText = ''
						}
					}

					//购买时间结束
					if (this.activityStatus == 4) {
						this.end()
						if (this.activityInfo.activitySelectionRecord) {
							//默认状态兼容其他状态签
							//未付款
							if (this.order && (this.activityInfo.activitySelectionRecord
									.activitySelectionRecordStatus == 4 || this.order?.status == 'WAIT_BUYER_PAY' ||
									this.order?.status == 'TRADE_CLOSED' || this.order?.status ==
									'BUYER_PART_PAYMENT' || this.order?.status == 'TRADE_CLOSED_BY_CLOUD')) {
								this.blackbg = false
								// this.drawButtonText = '查看订单'
								this.drawTipText = '支付超时，未完成支付'
								this.dlTextBoxBgColor = "#000"
							}
						}
					}

				}
			},

			async getOrder(et = new Date().getTime()) {
				let that = this;
				let merchantInfo = uni.getStorageSync(MERCHANT_INFO);
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				const parmas = {
					customer_id: customerInfo.customerId,
					merchant_id: merchantInfo.cloudMerchantId,
					page_no: 1,
					page_size: 100,
					store_id: merchantInfo.cloudMerchantStoreId
				};
				let json = await api.getMyOrderList({
					header: {
						jwt: customerInfo.jwt
					},
					query: parmas
				});

				let list = json?.data?.data?.content || []

				let order = list.find(item => {
					let ot = new Date(item.createTime).getTime()
					return item?.items[0]?.itemId == this.goodsId && ot > et
				})
				return order
			},
			setTimeOver(endTime, nowTime) {
				//超过一天就不继续监听倒计时了
				if ((endTime - nowTime) < 86400000) {
					this.timers.push(setTimeout(() => {
						this.getDrawInfo()
					}, endTime - nowTime))
				}
			},
			formatDate(date) {
				let data = date.slice(5, 10).replace('-', '月') + '日' + date.slice(11, 19)
				let month = data.substring(0, 2)
				if (month < 10) {
					data = data.slice(1)
				}
				return data
			},
			// 倒计时
			start(timestamp) {
				// 避免可能出现的倒计时重叠情况
				this.clearTimer();
				if (timestamp <= 0) return;
				let seconds = timestamp / 1000
				this.timer = setInterval(() => {
					seconds--;
					// 发出change事件
					if (seconds < 0) {
						return this.end();
					}
					this.formatTime(seconds);
				}, 1000);
			},
			// 格式化时间
			formatTime(seconds) {
				// 小于等于0的话，结束倒计时
				seconds <= 0 && this.end();
				let [day, hour, minute, second] = [0, 0, 0, 0];
				// 判断是否显示“天”参数，如果不显示，将天部分的值，加入到小时中
				// hour为给后面计算秒和分等用的(基于显示天的前提下计算)
				hour = Math.floor(seconds / (60 * 60));
				minute = Math.floor(seconds / 60) - hour * 60 - day * 24 * 60;
				second = Math.floor(seconds) - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60;
				// 如果小于10，在前面补上一个"0"
				hour = hour < 10 ? '0' + hour : hour;
				minute = minute < 10 ? '0' + minute : minute;
				second = second < 10 ? '0' + second : second;
				// this.h = hour;
				// this.i = minute;
				// this.s = second;
				this.showDate = ` ${hour}:${minute}:${second}`
			},
			// 停止倒计时
			end() {
				this.clearTimer();
				this.showDate = ''
			},
			// 清除定时器
			clearTimer() {
				if (this.timer) {
					// 清除定时器
					clearInterval(this.timer);
					this.timer = null;
				}
			},
			getFormatDate(timestamp) {
				const date = new Date(timestamp);
				const _month = date.getMonth() + 1;
				const month = _month > 9 ? _month : `0${_month}`;
				const day = date.getDate() > 9 ? date.getDate() : `0${date.getDate()}`;
				const hours = date.getHours() > 9 ? date.getHours() : `0${date.getHours()}`;
				const minutes = date.getMinutes() > 9 ? date.getMinutes() : `0${date.getMinutes()}`;

				return `${month}月${day}日 ${hours}:${minutes}`;
			},
			//埋点北京时间转换成utc时间
			trackDate(timeStamp) {
				var timeDifference = timeStamp - 8 * 60 * 60 * 1000;
				let utcDateTime = util.timeFormat(timeDifference, true)
				return utcDateTime
			},

			//开售提醒订阅
			remindRequest() {
				let that = this
				let templateId = ['3biNaYhS0dwQKynRfig5SI5ZEb_RVewTSAd0PE1CqgE',
					'u8hwBNiXZpt6IHeLjh1RlrmTjuScvjXXMG_un2RgOSc'
				];
				that.$commonSensors.popupEvent('PopupExposure', {
					'popup_type': '订阅消息',
					'popup_name': '订阅消息弹窗'
				})
				that.$commonSensors.modelAuthAsk('活动', templateId)
				uni.requestSubscribeMessage({
					tmplIds: templateId,
					success(res) {
						if (res['3biNaYhS0dwQKynRfig5SI5ZEb_RVewTSAd0PE1CqgE'] == "accept" && res
							.u8hwBNiXZpt6IHeLjh1RlrmTjuScvjXXMG_un2RgOSc == 'accept') {
							that.requestdrawMessage()
							that.$commonSensors.popupEvent('PopupClick', {
								'popup_type': '订阅消息',
								'popup_name': '订阅消息弹窗',
								'button_name': '允许'
							})
						} else if (res['3biNaYhS0dwQKynRfig5SI5ZEb_RVewTSAd0PE1CqgE'] == "accept") {
							that.startDrawMessage(1)
							that.$commonSensors.popupEvent('PopupClick', {
								'popup_type': '订阅消息',
								'popup_name': '订阅消息弹窗',
								'button_name': '允许'
							})
						} else if (res.u8hwBNiXZpt6IHeLjh1RlrmTjuScvjXXMG_un2RgOSc == 'accept') {
							that.resultDrawMessage(1)
							that.$commonSensors.popupEvent('PopupClick', {
								'popup_type': '订阅消息',
								'popup_name': '订阅消息弹窗',
								'button_name': '允许'
							})
						} else {
							that.$commonSensors.popupEvent('PopupClick', {
								'popup_type': '订阅消息',
								'popup_name': '订阅消息弹窗',
								'button_name': '拒绝'
							})
						}
						//抽签��登记权限�点
						that.commonTrack('c_ebmp_draws_remind', that.drawCommonTrack())
						that.$commonSensors.drawSensorsTrack('SubscribeNotification', that.detail, that
							.productPurchaseType)
					},
					fail(res) {
						that.requestdrawMessage()
					},
					complete(res) {

					}

				});
			},
			requestdrawMessage: async function() {
				// trial 测试版  formal正式版
				let remind = await this.startDrawMessage()
				let result = await this.resultDrawMessage()
				if (remind && result) {
					this.handleShowTextToast('订阅成功')
					setTimeout(() => {
						this.statusChange()
					})
				}
			},
			async isSecondRemindRquest() {
				let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
				const accountInfo = uni.getAccountInfoSync()
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let res = await api.getSaleMessage({
					method: 'POST',
					header: {
						jwt: customerInfo ? customerInfo.jwt : ''
					},
					query: {
						name: '甄选佳酿活动开始提醒',
						appId: accountInfo.miniProgram.appId,
						openId: userSpecialInfo.openid,
						params: {
							itemName: this.itemName,
							startTime: this.activityInfo.activitySelectionStartTime,
							activityId: this.activityInfo.activitySelectionId
						},
					},
				})
				if (res.code !== 1000) {
					return false
				} else {
					return true
				}
			},
			async startDrawMessage(flag) {
				let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
				const accountInfo = uni.getAccountInfoSync()
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let page = `/pages/item/item?id=${this.goodsId}&valueId=${this.valueId}&valueName=${this.colorName}`
				if (customerInfo) {
					let res = await api.sendSubMessage({
						method: 'POST',
						header: {
							jwt: customerInfo.jwt
						},
						query: {
							name: '甄选佳酿活动开始提醒',
							appId: accountInfo.miniProgram.appId,
							openId: userSpecialInfo.openid,
							params: {
								itemName: this.detail.itemName,
								startTime: this.activityInfo.activitySelectionStartTime,
								miniprogramState: this.eve,
								page: page,
								activityId: this.activityInfo.activitySelectionId,
								activityName: this.activityInfo.activitySelectionName
							},
						},
					});

					if (res.code == 1000) {
						if (flag) {
							this.handleShowTextToast('订阅成功');
							this.statusChange()
						}
						return true
					} else {
						this.handleShowTextToast(res.msg)
						return false
					}
				}
			},
			async resultDrawMessage(flag) {
				let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
				const accountInfo = uni.getAccountInfoSync()
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let page = `/pages/item/item?id=${this.goodsId}&valueId=${this.valueId}&valueName=${this.colorName}`
				if (customerInfo) {
					let res = await api.sendSubMessage({
						method: 'POST',
						header: {
							jwt: customerInfo.jwt
						},
						query: {
							name: '甄选佳酿活动结果通知',
							appId: accountInfo.miniProgram.appId,
							openId: userSpecialInfo.openid,
							params: {
								itemName: this.detail.itemName,
								publicationTime: this.activityInfo.promulgateTime,
								page: page,
								miniprogramState: this.eve,
								activityId: this.activityInfo.activitySelectionId,
								activityName: this.activityInfo.activitySelectionName
							},
						},
					});
					if (res.code == 1000) {
						if (flag) {
							this.handleShowTextToast('订阅成功');
							this.statusChange()
						}
						return true
					} else {
						this.handleShowTextToast(res.msg)
						return false
					}
				}
			},
			closeCheckDialog(type) {
				this.checkDialog = false
				this.$commonSensors.popupEvent('PopupClick', {
					'popup_type': '购买',
					'popup_name': '立即登记登记弹窗',
					'button_name': type
				})
			},
			//登记
			checkIn() {
				this.checkDialog = false
				//抽签购-确认活动规则埋点
				this.commonTrack('c_ebmp_draws_confirmrules', this.drawCommonTrack())
				this.$commonSensors.popupEvent('PopupClick', {
					'popup_type': '购买',
					'popup_name': '立即登记登记弹窗',
					'button_name': '确认登记'
				})
				this.tianYuCheck(2)
			},
			// 跳转活动规则页
			skipRule() {
				// let rulePath;
				// if (!!this.isSpecial) {

				// 	this.ruleBoxData = {
				// 		title: 'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/tsRule/tsRule_01.png',
				// 		list: [
				// 			'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/tsRule/tsRule_02_01.png',
				// 			'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/tsRule/tsRule_02_02.png',
				// 			'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/tsRule/tsRule_02_03.png',
				// 			'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/tsRule/tsRule_02_04.png',
				// 		]
				// 	}

				// 	rulePath = uni.getStorageSync('TsInfo').rulePath |
				// 		'/pages/cms/page?identifier=cms/targetsales&hideHome=true';
				// 	//会员限时专场活动细则
				// 	let {
				// 		tsActId,
				// 		name
				// 	} = uni.getStorageSync('TsInfo');
				// 	let c_from = '商品详情页';
				// 	let params = {
				// 		"c_pageName": c_from,
				// 		"c_campaignID": this.tsInfo.campaignTargetSaleId,
				// 		"c_campaignName": name
				// 	}
				// 	getApp().commonClTrack('c_ebmp_home_member_campaign_click_rules', params);

				// } else {
				this.ruleBoxData = {
					title: 'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/Pop-ups.png',
					list: [
						'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_01.png',
						'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_02.png',
						'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_03.png',
						'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_04.png',
						'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_05.png',
					]
				}
				// rulePath = '/pages/draw/drawRule?identifier=' + this.ruleId
				// }
				this.isActivityRule = true
				// uni.navigateTo({
				// 	url: rulePath
				// })
			},

			// 跳转活动规则页
			skipRule2() {
				let rulePath = '/pages/item/balloutTime?utid=244'

				uni.navigateTo({
					url: rulePath
				})
			},

			// 跳转分享页
			skipShare() {
				//	非会员 弹窗入会弹窗
				if(this.btnStatus === 1){
					this.$refs.registerWidgetRef.openJoinMemberModal();
					return;
				}
				let sharePic = this.activitySwitch ? this.activityInfo.shareCardPicUrl : '';
				let url = sharePic || this.shareImage || this.carouselArrId[0].url
				let params = {
					'goodsId': this.goodsId,
					'valueId': this.valueId,
					'colorName': this.colorName,
					'url': this.carouselArrId[0].url,
					'itemName': this.detail.newitemName,
					'price': this.price,
					'shareText': this.activitySwitch ? this.activityInfo.shareCardDesc : this.detail.itemName,
					'shareCardPicUrl': url,
					'sharePosterPath': this.sharePosterPath,
					'shareCardLink': this?.activityInfo?.shareCardLink,
					'activitySwitch': this.activitySwitch,
					'taskContentId': this.navText == '任务已完成' ? '' : this.taskContentId,
					'taskCenterCode': this.navText == '任务已完成' ? '' : this.taskCenterCode,
					'taskContentName': this.navText == '任务已完成' ? '' : this.taskContentName
				}
				let options = JSON.stringify(params)

				let shareUrl = '/pages/item/itemShare?params=' + encodeURIComponent(options);
				let sharePageTitle = '分享';

				//点击分享tracking
				let clShareParams = {
					"c_area": "商品标题旁分享",
					"c_link_pagename": sharePageTitle,
					"c_link_path": shareUrl
				}
				this.shareTrack(clShareParams)

				uni.navigateTo({
					url: shareUrl
				})
				//分享埋点
				let productStatu = this.btnText === 1 ? '售罄' : this.btnText == 3 ? '正常' : this.btnText == 4 ? '下架' : '';
				this.$commonSensors.pdpEvent('PDPClick', this.detail, '分享', this.productPurchaseType, this.btnText == 1,
					this
					.drawButtonText == '立即购买')
				this.commonTrack('c_ebmp_product_share', {})
			},
			disabledBuy() {
				let memberDetails = uni.getStorageSync('memberDetails');
				if (!memberDetails || this.canBuy == 1) {
					this.getUserProfile();
				} else if (this.canBuy == 2) {
					this.handleShowTextToast('请提升会员等级后购买');
				}
			},
			jiaBtnTap() {
				//库存不足
				if (this.ccJson[this.valueId].frontQty < 1) {
					this.handleShowTextToast('商品库存不足')
					return false
				}
				if (this.chooseQty === this.ccJson[this.valueId].frontQty) {
					this.handleShowTextToast('商品库存不足')
					return false;
				} else {
					if (this.chooseQty >= this.limitQty && this.limitQty != -1) {
						this.handleShowTextToast('已超出限购数量，详情请咨询顾问');
						return false;
					}
					this.chooseQty++;
					this.$commonSensors.popupEvent('PopupClick', {
						'popup_type': '商品弹窗',
						'popup_name': '半屏加购弹窗',
						'button_name': '增加'
					})
				}
			},
			jianBtnTap() {
				if (this.chooseQty > 1) {
					this.chooseQty--;
					this.$commonSensors.popupEvent('PopupClick', {
						'popup_type': '商品弹窗',
						'popup_name': '半屏加购弹窗',
						'button_name': '减少'
					})
				} else {
					this.handleShowTextToast('购买数量低于购买范围')
				}
			},
			tabSensors(index) {
				this.$commonSensors.pdpEvent('PDPClick', this.detail, this.tabList[index].text, this.productPurchaseType,
					this
					.btnText == 1)
			},
			paramsShowFunction() {
				this.paramsShow = true
				this.$commonSensors.pdpEvent('PDPClick', this.detail, '参数', this.productPurchaseType, this.btnText == 1)
			},
			tipShowFunction() {
				this.tipShow = true
				this.$commonSensors.pdpEvent('PDPClick', this.detail, '温馨提示', this.productPurchaseType, this.btnText == 1)
			},
			closeChooseBox() {
				this.parameterShow = false;
				this.$commonSensors.popupEvent('PopupClick', {
					'popup_type': '商品弹窗',
					'popup_name': '半屏加购弹窗',
					'button_name': '关闭'
				})
			},
			chooseBoxShow(e) {
				let that = this
				if (!this.activitySwitch && !this.isLuckyDrawItem && !this.isSpecial && !this.showIntent) {
					this.parameterShow = true;
				}
				if (!!this.isSpecial && !this.isLuckyDrawItem) {
					this.$refs.tsRef.chooseBoxShow(true)
				}
				that.$commonSensors.pdpEvent('PDPClick', that.detail, e?.currentTarget.dataset?.tracktype || '', that
					.productPurchaseType, that.btnText == 1, this.drawButtonText == '立即购买')
				that.$commonSensors.popupEvent('PopupExposure', {
					'popup_type': '商品弹窗',
					'popup_name': '半屏加购弹窗'
				})
			},
			async fastTabClick(item, index, type) {
				if (item.type == 'cart') {
					uni.navigateTo({
						url: item.path,
					})
					this.$commonSensors.pdpEvent('PDPClick', this.detail, item.title, this.productPurchaseType, this
						.btnText == 1, this.drawButtonText == '立即购买')
				} else if (item.type == 'love') {
					if (!uni.getStorageSync(CUSTOMER_INFO).jwt) {
						this.registerType = 'addFav'
						this.getUserProfile()
					} else {
						let operateMode = type == 'intent' ? 'auto' : 'manual'

						let operateType;
						if (!item.isAct) {
							operateType = 'add'
						} else {
							operateType = 'cancel'
						}
						let res = await setFav(this.detail, operateType, this.valueId, 0, operateMode)
						const {
							status,
							times
						} = res
						if (status && operateType == 'add') {
							// this.commonTrack('c_ebmp_wish_list_add_to_wish_list', {
							// 	c_link_pagename: '商品详情页',
							// })
							this.isLove.isAct = true

							if (times == 1 && type !== 'intent') {
								this.openFavModal()
							} else {
								if (type !== 'intent') {
									//自定义提示
									let obj = {
										msg: '已添加至我的心愿单',
										success: true
									}
									this.handleCartToast(obj)
								}
							}
						} else if (status && operateType == 'cancel') {
							this.isLove.isAct = false
							if (type !== 'intent') {
								this.handleShowTextToast('已取消')
							}
						}
						if (type !== 'intent') {
							this.$commonSensors.pdpEvent('PDPClick', this.detail, this.isLove.isAct ? '喜欢' : '取消喜欢',
								this.productPurchaseType, this.btnText == 1, this.drawButtonText == '立即购买')
						}
					}
				} else if (item.type == 'adviser') {
					this.$commonSensors.simpleTrack('OnlineCustomerService')
					let clTrackPrams = {
						'c_pagename': this.nowPages
					}
					getApp().commonClTrack('c_ebmp_click_cs', clTrackPrams)
				}
			},
			openFavModal() {
				this.$refs.favRef.open()
			},
			// 商品详情信息
			getGoodsDetail: async function(goodsId = null) {
				// return null
				try {
					let that = this;
					let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
					let merchantInfo = uni.getStorageSync('merchantInfo') || (await getApp().getMerchantInfo());
					const json = await api.goodsDetail({
							query: {
								merchant_id: merchantInfo.cloudMerchantId,
								store_id: merchantInfo.cloudMerchantStoreId
							}
						},
						goodsId || that.goodsId
					);
					if (json.code === 1000) {
						let data = json.data;
						this.goodsInfo = json
						that.itemName = data.itemName;
						that.itemCode = data.itemCode;
						that.limitSkuID = data.skus[0].skuId;
						that.frontQty = data.qty;
						that.isSpecial = false
						that.intentSwitch = false
						that.noticeText = false
						this.totalQtyOut = -1
						this.productList = {}
						this.pdpShowVideoConfig = false;
						that.sharePosterPath = `pages/item/item?id=${this.goodsId}&valueId=${this.valueId}`
						that.enableArrivalNotice = true // uni.getStorageSync("arrivalNotice") && json.data.arrivalNotice ==1 ? true : false
						let itemCustomParameters = JSON.parse(data.itemCustomParameters);
						//特殊购买自定义参数disableShare为true时禁止分享
						that.disableShare = itemCustomParameters.disableShare;
						that.isLuckyDrawItem = itemCustomParameters.isLuckyDrawItem;
						that.isSpAo = itemCustomParameters.isSpAo
						if (!!that.disableShare) {
							uni.hideShareMenu()
						}
						// 获取是否展示视频配置
						const pdpVideoConfig = await api.getStoreInfo({
							method: 'GET',
							query: {
								config_client_id: 'efcloud',
								config_path: 'item/pdp/show_pdp_video',
								config_scope: 'Store',
								config_scope_id: merchantInfo.cloudMerchantStoreId,
								merchant_id: merchantInfo.cloudMerchantId
							}
						});
						if (pdpVideoConfig.code === 1000) {
							that.pdpShowVideoConfig = pdpVideoConfig.data.value;
						}
						this.hasDrawInfo = true
						// // 商品所有cc集合
						let valueArr = [];
						// 判断当前商品是否为新品
						let newArrivalArr = [];
						let ccJson = {};
						this.isC2Bgoods = false;
						this.isC2BgoodsIndex = -1;
						data.frontProperties.forEach(function(item, index, array) {
							let ccid = item.valueId;
							item.frontCustomParameters = JSON.parse(item.frontCustomParameters);
							//	判断商品是否为c2b定制商品
							if(item.frontCustomParameters && item.frontCustomParameters['c2bGoods'] == 1){
								that.isC2Bgoods = true;
							}
							if(item.frontCustomParameters && item.frontCustomParameters['c2bIndex']){
								that.isC2BgoodsIndex = Number(item.frontCustomParameters['c2bIndex']);
							}
							if (!!item.frontCustomParameters && item.frontCustomParameters[
									'privateSaleMark'] == 1) {
								that.isSpecial = true; //特殊购买自定义参数为1时是特殊购买商品isSpecial为true
							}

							if (!!item.frontCustomParameters && item.frontCustomParameters[
									'intentCheckMark'] == 1) {
								that.intentSwitch = true; //意向登记
							}
							if (!!item.frontCustomParameters && item.frontCustomParameters[
									'shareposterpath']) {
								if (item.frontCustomParameters['shareposterpath'].indexOf('?') === -1) {
									that.sharePosterPath = item.frontCustomParameters['shareposterpath'] +
										'?scene=default'
								} else {
									that.sharePosterPath = item.frontCustomParameters[
										'shareposterpath']; //分享海报的太阳码
								}
							}
							if (!!item.frontCustomParameters && item.frontCustomParameters['noReachContext']) {
								if (item.frontCustomParameters['noReachContext'] !== '') {
									that.noticeText = []
									that.noticeText[0] = item.frontCustomParameters['noReachContext']
								}
							}
							ccJson[item.valueId] = item;
							// ccJson[index] = item;
							valueArr.push(item.valueId);
							// valueArr.push(index);
							if (item.newStartTime && item.newEndTime && util.isDuringDate(item.newStartTime,
									item.newEndTime)) {
								newArrivalArr.push(item.valueId);
								// newArrivalArr.push(index);
							}
						});
						this.newArrivalArr = newArrivalArr;

						that.ccJson = ccJson;
						// 如果查找当前cc不存在,默认切换为第一个cc
						if (valueArr.length > 0 && valueArr.indexOf(parseInt(that.valueId)) === -1) {
							// 如果当前cc信息没有返回(valueid错误或者该cc下架售罄不显示),弹窗当前cc已下架,并切换到其他cc
							that.valueId = valueArr[0];
							that.colorName = ccJson[that.valueId].valueName;

						} else {
							// that.colorName = ccJson[that.valueId].valueName;
							that.colorName = ccJson[that.valueId].valueName;
						}

						that.title_EN = ccJson[that.valueId]?.frontCustomParameters?.className
						var priceArr = [];
						let markingPriceArr = [];
						// skuProperties 颜色 尺寸
						let skuProperties = [];
						const skus = data.skus;
						// detail  商品详情信息
						let itemName = ccJson[that.valueId]?.frontCustomParameters?.itemName
						data.itemName = data.itemName

						data.newitemName = itemName ? itemName.replace("|", "\n") : data.itemName
						that.detail = data;

						// 判断是否收藏
						let favStatus = await checkFavStatus(data.outerItemId, 0)
						let intentStatus = await checkFavStatus(data.outerItemId, 1)
						this.intentChecked = intentStatus
						this.isLove.isAct = favStatus
						if (data.qty === 0) {
							this.totalQtyOut = 1;
						}
						// 价格
						for (var i = 0; i < data.skus.length; i++) {
							priceArr.indexOf(data.skus[i].price) == -1 ? priceArr.push(data.skus[i].price) : '';
							markingPriceArr.indexOf(data.skus[i].markingPrice) == -1 ? markingPriceArr.push(data.skus[
									i]
								.markingPrice) : '';
						}

						that.markingPrice = markingPriceArr[0];

						let description = !!data.description ? data.description.replace('<br />', '<p></p>') : '';
						this.uData = description;

						// 轮播图图片排序,根据 sortOrder 从小到大排序
						that.detail.resources.sort(function(a, b) {
							return a.sortOrder - b.sortOrder;
						});
						that.carousel = that.detail.resources;
						let carouselArr = [];
						
						// 处理存储轮播图数组
						that.carousel.forEach(function(item, index, array) {
							if (item.valueId == that.valueId && item.kind == 'loop') {
								carouselArr.push(item);
							}
							//根据传递的valueId显示分享图
							if (item.valueId == that.valueId && item.kind == 'share') {
								that.shareImage = item.url
							}
						});
						// 如果当前cc没有轮播图,则显示该商品下其他轮播图
						that.carouselArrId = carouselArr.length === 0 ? that.carousel : carouselArr;
						//  isFront 1-- 颜色 0-- 尺码
						// 库存不为0的数据  qtyNotZero
						for (var i = 0; i < skus.length; i++) {
							if (skus[i].skuProperties[0].valueId == parseInt(this.valueId)) {
								this.productSKU = skus[i].skuId;
							}

							let skuProperties = skus[i].skuProperties;
							let tmpKey = '';
							let tmpFront = '';
							let flag = skus[i].qty;
							let skuCode = skus[i].skuCode;
							// 过滤掉0库存,对有库存的遍历
							for (var j = 0; j < skuProperties.length; j++) {
								if (skuProperties[j].isFront === 1) {
									if (skuProperties[j].valueId == that.valueId) {
										this.productPickImg = skus[i].skuImageUrl;
									}
									tmpFront = skuProperties[j].valueName;
									if (this.productArr.indexOf(skuProperties[j].valueName) < 0) {
										this.productArr.push(skuProperties[j].valueName);
										this.productColorList[tmpFront] = [];
										this.ccDescriptionJson[skuProperties[j].valueId] = skuProperties[j]
											.frontDescription;
									}
								} else {
									this.productColorList[tmpFront].push(skuProperties[j]);
									this.sizeName = skuProperties[j].propertyName;
									skuProperties[j].qty = flag;
									skuProperties[j].sku_code = skuCode;
								}
								tmpKey += skuProperties[j].valueName;
							}
							this.productList[tmpKey] = skus[i];
						}
						// // 给cc描述赋值
						// this.uData = !!this.valueId &&!!this.ccDescriptionJson[this.valueId] ? this.ccDescriptionJson[this.valueId].replace(
						//   '<br />',
						//   '<p></p>') : this.uData;

						for (let i = 0; i < skus.length; i++) {
							let key = skus[i].skuProperties[0].valueName;
							if (that.colorPriceJson.colorList.indexOf(key) === -1) {
								that.colorPriceJson.colorList.push(key);
							}

							if (that.colorPriceJson.hasOwnProperty(key)) {
								if (that.colorPriceJson[key].priceArr.indexOf(skus[i].price) === -1) {
									that.colorPriceJson[key].priceArr.push(skus[i].price);
								}
								if (that.colorPriceJson[key].qtyArr.indexOf(skus[i].qty) === -1) {
									that.colorPriceJson[key].qtyArr.push(skus[i].qty);
								}

								that.colorPriceJson[key].sallState.priceDescription = skus[i].skuProperties[0]
									.priceDescription;
								that.colorPriceJson[key].sizePrice.push({
									markingPrice: skus[i].markingPrice,
									price: skus[i].price,
									size: skus[i].skuProperties[1].valueName,
									qty: skus[i].qty
								});
								that.colorPriceJson[key].totalQty += parseInt(skus[i].qty);
							} else {
								that.colorPriceJson[key] = {
									priceArr: [],
									qtyArr: [],
									sizePrice: [],
									totalQty: 0,
									skuCode: skus[i].skuCode
								};
								that.colorPriceJson[key].priceArr = that.colorPriceJson[key].priceArr ? [] : that
									.colorPriceJson[
										key]
									.priceArr;
								that.colorPriceJson[key].priceArr.push(skus[i].price);
								that.colorPriceJson[key].qtyArr = that.colorPriceJson[key].qtyArr ? [] : that
									.colorPriceJson[key]
									.qtyArr;
								that.colorPriceJson[key].qtyArr.push(skus[i].qty);
								that.colorPriceJson[key].totalQty += parseInt(skus[i].qty);
								that.colorPriceJson[key].sizePrice = that.colorPriceJson[key].sizePrice === undefined ? [] : that
									.colorPriceJson[key].sizePrice;
								that.colorPriceJson[key].sizePrice.push({
									markingPrice: skus[i].markingPrice,
									price: skus[i].price,
									size: skus[i].skuProperties[1] ? skus[i].skuProperties[1].valueName : null,
									qty: skus[i].qty
								});
								that.colorPriceJson[key].sallState = that.colorPriceJson[key].sallState === undefined ? {} : that
									.colorPriceJson[key].sallState;
								that.colorPriceJson[key].sallState.priceDescription = skus[i].skuProperties[0]
									.priceDescription;
								that.colorPriceJson[key].valueId = skus[i].skuProperties[0].valueId;
								that.colorPriceJson[key].ccMainImage = skus[i].skuImageUrl || skus[i].skuImageUrl;
							}
						}

						for (let i = 0; i < that.colorPriceJson.colorList.length; i++) {
							let idx = that.colorPriceJson.colorList[i];
							let priceArr = that.colorPriceJson[idx].priceArr ? that.colorPriceJson[idx].priceArr : [];

							if (priceArr.length > 1) {
								priceArr.length >= 2 ? priceArr.sort() : '';
								priceArr.length >= 2 ? (priceArr = that.priceSort(priceArr)) : '';
								priceArr.length > 2 ? priceArr.splice(1, priceArr.length - 2) : '';
								that.colorPriceJson[idx].priceString = priceArr.length >= 2 ? true : false;
								that.price = priceArr.length == 2 ? that.priceFixed(priceArr[0]) + ' - ' + that
									.priceFixed(priceArr[
										1]) : that.priceFixed(priceArr[0]);
								that.maxPrice = priceArr.length == 2 ? priceArr[1] : that.priceFixed(priceArr[0]);
							} else {
								that.colorPriceJson[idx].priceString = false;
							}
							this.totalQtyOut = that.colorPriceJson.colorList.length == 0 || data.qty == 0 ? 1 : 0;
						}

						that.productArr = that.colorPriceJson.colorList;
						let index = 0;
						let color = '';
						if (that.colorPriceJson.colorList.length > 0) {
							let soldOutAll = that.colorPriceJson.colorList.every(function(item, index, array) {
								return that.ccJson[that.valueId].approveStatus !== 'onsale' || (that
									.colorPriceJson[item].qtyArr
									.length == 1 && that.colorPriceJson[item].qtyArr[0] == 0);
							});
							let soldOutCurrentCC =
								that.colorName == '' ||
								that.colorName == undefined ||
								that.colorPriceJson.colorList.indexOf(that.colorName) == -1 ||
								(that.colorPriceJson[that.colorName].qtyArr.length == 1 && that.colorPriceJson[that
										.colorName]
									.qtyArr[
										0] == 0) ||
								that.ccJson[that.valueId].approveStatus !== 'onsale';
							if (!soldOutAll && soldOutCurrentCC) {
								color = this.colorPriceJson.colorList[0];

								const colName = that.colorPriceJson.colorList[0];
								that.colorName = colName;

								let priceArr = that.colorPriceJson[colName].priceArr ? that.colorPriceJson[colName]
									.priceArr : '';

								priceArr.length >= 2 ? priceArr.sort() : '';
								priceArr.length >= 2 ? (priceArr = that.priceSort(priceArr)) : '';
								priceArr.length > 2 ? priceArr.splice(1, priceArr.length - 2) : '';
								that.priceString = priceArr.length >= 2 ? true : false;
								that.price = priceArr.length == 2 ? that.priceFixed(priceArr[0]) + ' - ' + that
									.priceFixed(priceArr[
										1]) : that.priceFixed(priceArr[0]);
								that.maxPrice = priceArr.length == 2 ? priceArr[1] : that.priceFixed(priceArr[0]);
								let markingPriceArray = that.colorPriceJson[colName].sizePrice;
								that.markingPrice = that.priceFixed(that.colorPriceJson[colName].sizePrice[0]
									.markingPrice);
								let valueIdFlag = '';
								for (var l = 0; l < data.skus.length; l++) {
									if (data.skus[l].skuProperties[0].valueName == color) {
										valueIdFlag = data.skus[l].skuProperties[0].valueId;
										this.valueId = valueIdFlag;
									}
								}

								// 根据传递的valueId显示轮播图
								let carouselArr = [];
								for (var i = 0; i < that.carousel.length; i++) {
									if (this.carousel[i].valueId == this.valueId && this.carousel[i].kind == 'loop') {
										carouselArr.push(that.carousel[i]);
										if (this.carousel[i].type == 'video' && this.carousel[i].isDeleted == 0 && that
											.pdpShowVideoConfig) {
											that.$refs.swiperRef.setPlayStatus(false)
										}
									} else if (this.carousel[i].valueId !== this.valueId && this.carousel[i].kind ==
										'major') {
										that.carousel.splice(i, 1);
										i--;
									}
								}
								if (carouselArr.length === 0) {
									this.carousel.unshift({
										kind: 'loop',
										url: this.colorPriceJson[this.colorName].ccMainImage
									});
								}
								this.carouselArrId = carouselArr.length === 0 ? this.carousel : carouselArr;

								let colorImgFlag = '';
								for (var l = 0; l < data.resources.length; l++) {
									if (data.resources[l].valueId == valueIdFlag) {
										colorImgFlag = data.resources[l].url;
										this.productPickImg = colorImgFlag;
									}
								}
								this.showPriceDescription =
									that.colorPriceJson[color].sallState.priceDescription == null ||
									that.colorPriceJson[color].sallState.priceDescription == undefined ||
									that.colorPriceJson[color].sallState.priceDescription == '' ?
									false :
									true;
								that.ccStock = that.colorPriceJson[color].qtyArr.length === 1 && that.colorPriceJson[
									color].qtyArr[
									0] === 0 ? true : false;
							} else {
								index = this.colorPriceJson.colorList.indexOf(this.colorName);
								that.colorIdx = index;
								color = this.colorPriceJson.colorList[index];
								let priceArr = that.colorPriceJson[that.colorName].priceArr ? that.colorPriceJson[that
										.colorName]
									.priceAr : '';
								if (!!priceArr) {
									priceArr.length >= 2 ? priceArr.sort() : '';
									priceArr.length >= 2 ? (priceArr = that.priceSort(priceArr)) : '';
									priceArr.length > 2 ? priceArr.splice(1, priceArr.length - 2) : '';
									that.priceString = priceArr.length >= 2 ? true : false;
									that.price = priceArr.length == 2 ? that.priceFixed(priceArr[0]) + ' - ' + that
										.priceFixed(
											priceArr[
												1]) : that.priceFixed(priceArr[0]);
									that.maxPrice = priceArr.length == 2 ? priceArr[1] : that.priceFixed(priceArr[0]);
								}
								let markingPriceArray = that.colorPriceJson[that.colorName].sizePrice;
								that.markingPrice = that.priceFixed(that.colorPriceJson[that.colorName].sizePrice[0]
									.markingPrice);
								for (let i = 0; i < markingPriceArray.length; i++) {
									that.markingPrice =
										parseInt(that.markingPrice) < parseInt(markingPriceArray[i].markingPrice) ?
										parseInt(
											markingPriceArray[i].markingPrice) : parseInt(that.markingPrice);
								}
								this.showPriceDescription =
									that.colorPriceJson[that.colorName].sallState.priceDescription == null ||
									that.colorPriceJson[that.colorName].sallState.priceDescription == undefined ||
									that.colorPriceJson[that.colorName].sallState.priceDescription == '' ?
									false :
									true;
								that.ccStock = that.colorPriceJson[color].qtyArr.length === 1 && that.colorPriceJson[
									color].qtyArr[
									0] === 0 ? true : false;
								// 根据传递的valueId显示轮播图
								let carouselArr = [];
								for (var i = 0; i < that.carousel.length; i++) {
									if (this.carousel[i].valueId == this.valueId && this.carousel[i].kind == 'loop') {
										carouselArr.push(that.carousel[i]);
										if (this.carousel[i].type == 'video' && this.carousel[i].isDeleted == 0 && that
											.pdpShowVideoConfig) {
											that.$refs.swiperRef.setPlayStatus(false)
										}
									} else if (this.carousel[i].valueId !== this.valueId && this.carousel[i].kind ==
										'major') {
										that.carousel.splice(i, 1);
										i--;
									}
								}
								if (carouselArr.length === 0) {
									this.carousel.unshift({
										kind: 'loop',
										url: this.colorPriceJson[this.colorName].ccMainImage
									});
								}
								that.carouselArrId = carouselArr.length === 0 ? that.carousel : carouselArr;
							}
							let priceArr = that.colorPriceJson[that.colorName].priceArr ? that.colorPriceJson[that
									.colorName]
								.priceAr : '';
							if (!!priceArr) {
								priceArr.length >= 2 ? priceArr.sort() : '';
								priceArr.length >= 2 ? (priceArr = that.priceSort(priceArr)) : '';
								priceArr.length > 2 ? priceArr.splice(1, priceArr.length - 2) : '';
								that.priceString = priceArr.length >= 2 ? true : false;
								that.price = priceArr.length == 2 ? that.priceFixed(priceArr[0]) + ' - ' + that
									.priceFixed(priceArr[
										1]) : that.priceFixed(priceArr[0]);
								that.maxPrice = priceArr.length == 2 ? priceArr[1] : that.priceFixed(priceArr[0]);

							}
							// 颜色对应CC无库存颜色图修改
							this.sizeArrsortOrder = this.productColorList[color];
							this.sizeArrsortOrder.sort(function(a, b) {
								return a.sortOrder - b.sortOrder;
							});
							this.sizeArr = this.sizeArrsortOrder;
							if (that.ccJson[that.valueId].approveStatus !== 'onsale') {
								this.sizeArr.forEach(item => {
									item.qty = 0;
								});
							}
							// 当尺码只有一个时默认勾选
							if (this.sizeArr.length == 1) {
								this.sizeIdx = 0;
								that.skuLists = this.productList[this.productArr[this.colorIdx] + this.sizeArr[0]
									.valueName];
								that.indexSize = this.sizeArr[0].valueName;
							} else {
								that.skuLists = this.productList[this.productArr[this.colorIdx]];
							}
						}

						if (this.productPickImg == '') {
							this.productPickImg = that.skuLists.skuImageUrl;
						}

						if (json.validDate == '0') {
							that.isValidDate = false;
							if (this.purchasetype == 1 && this.special != 1) {
								this.canOrder = false;
							}
						}

						// let enableMatomo = uni.getStorageSync('enableMatomo');
						// if (enableMatomo === true) {
						// 	let productSKU = JSON.stringify(that.productSKU);
						// 	getApp().matomo.setEcommerceView(productSKU, that.itemName, that.categoryName, that.price);
						// }

						this.$EFSTracking.trackingAction(
							'PDP_ITEM',
							JSON.stringify({
								itemId: this.goodsId,
								itemName: this.itemName,
								itemCode: this.itemCode,
								imageSrc: this.productPickImg
							}), {}
						);
						that.getPriceRules();
						that.getGoodsPromotion();
						await that.getAvailableQty()
						//页面跳转至pdp页的埋点
						if (that.ccJson[that.valueId].frontCustomParameters !== null) {
							that.trackBrand = that.ccJson[that.valueId].frontCustomParameters.brand;
							that.trackSeries = that.ccJson[that.valueId].frontCustomParameters.series;
							that.trackDegrees = that.ccJson[that.valueId].frontCustomParameters.degrees;
						} else {
							that.trackBrand = '';
							that.trackSeries = '';
							that.trackDegrees = '';
						}
						let productStatu = this.btnText === 1 ? '售罄' : this.btnText == 3 ? '正常' :
							this.btnText == 4 ? '下架' : '';

						let {
							tsActId,
							name
						} = uni.getStorageSync('TsInfo');
						
						setTimeout(() => {
							let clTrackPrams = {
								'c_from': that.nextPages + that.trackPageName,
							}
							if (this.from !== 'default') {
								clTrackPrams.campaign = 'SZSH_LITHA_LAUNCH-2023'
								clTrackPrams.c_from = that.from == 'button' ?
									'/pages/litha/lithalitha活动页Button/埋点115 Litha首屏立即加购' :
									'/pages/litha/lithalitha活动页Banner/埋点116 Litha首屏底部立即加购'
								that.commonTrack('litha_product_open', clTrackPrams, 1)
							}
							that.commonTrack('c_ebmp_product_open', clTrackPrams)
							let pdpParamsReport = {
								colorPriceJson: that.colorPriceJson,
								colorName: that.colorName,
								isBlackListUser: uni.getStorageSync('isBlackListUser'),
								ccJson: that.ccJson,
								valueId: that.valueId
							}
							wx.reportEvent("sell_out_report", {
								"pdp_params": JSON.stringify(pdpParamsReport)
							})

						}, 3000);
						return null
					} else {
						uni.redirectTo({
							url: '/pages/util/pageNotFound'
						});
						setTimeout(() => {
							that.showLoaded = false
						}, 500);
						if (json.msg) {} else {
							that.handleShowTextToast('查看商品失败');
						}
					}
					if (customerInfo.jwt) {
						that.limitPurchase();
					}
				} catch (e) {

				}


			},
			// 获取限购qty信息
			limitPurchase: async function() {
				let that = this
				let merchantInfo = uni.getStorageSync('merchantInfo');
				let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
				const json = await api.limitPurchase({
					method: 'GET',
					header: {
						jwt: jwt
					},
					query: {
						'merchant_id': merchantInfo.cloudMerchantId,
						'sku_id': that.limitSkuID,
						'store_id': merchantInfo.cloudMerchantStoreId,
						'relation_limit_sku_ids': !!that.ccJson[that.valueId] && !!that.ccJson[that.valueId]
							.frontCustomParameters && !!that.ccJson[that.valueId].frontCustomParameters[
								'relationLimitSkuIds'] ?
							that.ccJson[that.valueId].frontCustomParameters[
								'relationLimitSkuIds'] : ''
					}
				});
				if (json.code === 1000) {
					let data = json.data;
					that.limitQty = data

				}
			},

			getUserProfile: async function() {
				this.$commonFunction.commonLoginNew().then(res => {
					if (res.code !== 1000) {
						this.$refs.registerWidgetRef.openJoinMemberModal()
					} else if (res.data && res.data.mobile) {
						//  非大陆手机号按照非会员对待,重新入会
						const phoneNumberReg = /^1\d{10}$/;
						if (!phoneNumberReg.test(res.data.mobile)) {
							this.$refs.registerWidgetRef.openJoinMemberModal()
						}
					}
				}).catch(err => {
					this.$refs.registerWidgetRef.openJoinMemberModal()
				})
			},
			// 注册入会成功返回的状态
			registerSuccess: async function(e) {
				if (e.componentName == 'message-modal') {
					uni.setStorageSync('firstEnter', true)
				}
				if (e.componentName == 'age-check-modal' || this.showLoaded) {
					return
				}
				await this.getMemberDetail()
				this.getAvailableQty()
				this.getGoodsPromotion()
				this.limitPurchase()
				this.userStatus();
				this.getDrawInfo()
				if (this.goodsId == this.lithaGood) {
					this.lithaSubcirble()
				}
			},
			stopClick() {
				return false
			},
			/**
			 * 注册入会成功之后自执行方法判断
			 * 解密unionId
			 * 获取邀请码
			 */
			userStatus: async function() {
				// 用户是否登录
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || '';
				if (customerInfo) {
					if (this.registerType == 'cart') {
						this.takeCart();
					} else if (this.registerType == 'buynow') {
						this.buyItNow('buynow', 1);
					} else if (this.registerType == 'buyDraw') {
						this.buyItNow('buyDraw', 4);
					} else if (this.registerType == 'buySpecial') {
						this.buyItNow('buySpecial', 3);
					} else if (this.registerType == 'addFav') {
						this.fastTabClick(this.isLove, 1)
					} else if (this.registerType == 'addIntent') {
						this.intentHandle()
					}
				}
			},
			priceFixed(pri) {
				pri = typeof pri == 'number' ? pri : Number(pri);
				let integer = pri % 1;
				if (pri == 0) {
					return pri;
				} else if (integer == 0) {
					return pri;
				} else {
					return pri.toFixed(2);
				}
			},

			// 判断是否有merchantInfo,没有则重新请求
			getCurrentMerchantInfo: async function() {
				let that = this;
				var merchantInfo = uni.getStorageSync(MERCHANT_INFO) || '';
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				if (!customerInfo) {
					try {
						await that.$commonFunction.commonLoginNew()
					} catch (e) {
						this.btnStatus = 1;
						this.disabledBtnText = "入会解锁购买权限"
					}

				}
				if (!merchantInfo) {
					// 获取商户信息
					const accountInfo = uni.getAccountInfoSync(); // 小程序appId
					var merchantInfo = await api.merchantInfo(accountInfo.miniProgram.appId);
					if (merchantInfo.code === 200) {
						// 存储商户信息
						uni.setStorageSync(MERCHANT_INFO, merchantInfo.data);
					}
				}
				return null
			},

			/**
			 * 判断是否是会员
			 *
			 * @param jwt
			 * @return {Promise<void>}
			 */
			getMemberDetail: async function(jwt) {
				let that = this;
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				if (!!customerInfo) {
					const memberDetailsResult = await api.getMemberDetails({
						header: {
							jwt: customerInfo.jwt
						}
					});
					if (memberDetailsResult.code == 1000) {
						const phoneNumberReg = /^1\d{10}$/;
						if (!phoneNumberReg.test(memberDetailsResult.data.mobile)) {
							// 非大陆手机号按照非会员对待,重新入会
							uni.removeStorageSync('memberDetails');
							this.customerGroupId = 0;
							this.memberLevelId = 0;
							this.btnStatus = 1;
							this.disabledBtnText = "入会解锁购买权限"
							return;
						}
						this.btnStatus = 0;
						if (this.activitySwitch) {
							that.verifyDrawIdentify(this.activityInfo)
						}
						uni.setStorageSync('memberDetails', memberDetailsResult.data)
						that.customerGroupId = customerInfo.groupId;
						that.memberLevelId = memberDetailsResult.data.memberLevelId;
						await that.getMemberLevel(that.memberLevelId)
					} else {
						this.btnStatus = 1;
						this.disabledBtnText = "入会解锁购买权限"
					}
				}
			},
			// 获取会员等级信息
			getMemberLevel: async function(id) {
				let that = this;
				let memberLevelId = id;
				let merchantInfo = getApp().globalData.merchantInfo || uni.getStorageSync(MERCHANT_INFO);
				const json = await api.getMemberLevel({
						query: {
							member_level_id: memberLevelId,
							merchant_id: merchantInfo.cloudMerchantId,
						}
					},
					memberLevelId
				);
				if (json.code == 1000) {
					that.levelName = json.data.levelName;
				}
			},
			// 商品标签
			getGoodsPromotion: async function() {
				let that = this;
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				let memberDetails = uni.getStorageSync('memberDetails') || '';
				if (!this.valueId) {
					return false;
				}
				const json = await api.goodsPromotion({
						method: 'GET',
						query: {
							price: this.price
						}
					},
					uni.getStorageSync(MERCHANT_INFO).cloudMerchantId,
					uni.getStorageSync(MERCHANT_INFO).cloudMerchantStoreId,
					that.goodsId,
					that.valueId
				);
				if (json.code === 1000) {
					let data = json.data;
					let ispromotionArr = [];
					var tempPromotionArr = data;
					var customPromotionTags = [];
					for (var t in tempPromotionArr) {
						var tagItem = tempPromotionArr[t];
						if (getApp().isDuringDate(tagItem.beginTime, tagItem.endTime)) {
							if (that.promotionJson.hasOwnProperty(tagItem.promotionType)) {
								that.promotionJson[tagItem.promotionType].push(tagItem);
							} else {
								that.promotionJson[tagItem.promotionType] = [];
								that.promotionJson[tagItem.promotionType].push(tagItem);
							}
							if (tagItem.promotionType == 'forward_purchase') {
								// 没有member信息需要注册
								if (!memberDetails) {
									this.btnStatus = 1;
									this.disabledBtnText = "入会解锁购买权限"
								} else if (!!memberDetails) {
									// 允许所有人购买
									if (!tagItem.groupIds && !tagItem.memberLevelIds) {
										this.btnStatus = 0;
									} else if (!!tagItem.memberLevelIds && tagItem.memberLevelIds.indexOf(memberDetails
											.memberLevelId) !== -1 || (!!tagItem.groupIds && tagItem.groupIds.indexOf(
											customerInfo.groupId) !== -1)) {
										this.btnStatus = 0;
										this.disabledBtnText = tagItem.promotionTag
									} else if (!!tagItem.memberLevelIds && tagItem.memberLevelIds.indexOf(memberDetails
											.memberLevelId) == -1) {
										this.btnStatus = 2;
										this.disabledBtnText = tagItem.promotionTag
									} else if (!!tagItem.groupIds && tagItem.groupIds.indexOf(customerInfo.groupId) ==
										-1) {
										this.btnStatus = 3;
										this.disabledBtnText = tagItem.promotionTag
									}
								}
							} else if (tagItem.promotionType == 'activity_limit_purchase') {
								if (!!tagItem.memberLevelIds && tagItem.memberLevelIds.indexOf(memberDetails
										.memberLevelId) !== -1) {
									ispromotionArr.push(tempPromotionArr[t])
								} else if (!tagItem.memberLevelIds) {
									ispromotionArr.push(tempPromotionArr[t])
								}
							} else {
								ispromotionArr.push(tempPromotionArr[t])
							}
						}

						if (tagItem.promotionType == 'custom_tag') {
							customPromotionTags.push(tagItem);
						}
					}
					var tempTagList = customPromotionTags.slice();
					tempTagList.sort((a, b) => {
						return a.sortOrder - b.sortOrder;
					});
					that.promotionArr = ispromotionArr;
					that.customPromotionArr = tempTagList;

				}
				that.getDrawInfo()
			},
			getPriceRules: async function() {
				let that = this;
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				let memberDetails = uni.getStorageSync('memberDetails') || getApp().globalData
					.memberDetails;
				if (!this.valueId) {
					return false;
				}
				const json = await api.getPriceRules({
						query: {
							group_id: customerInfo.groupId || 0,
							member_level_id: memberDetails.memberLevelId || 0,
							member_status: memberDetails.isActive || 'Inactive'
						}
					},
					uni.getStorageSync(MERCHANT_INFO).cloudMerchantId,
					that.detail.itemId,
					that.valueId
				);
				that.price = that.price <= 0 ? that.markingPrice : that.price
				if (json.code === 1000) {
					let rulePriceJson = await getApp().priceRulesDeal(json.data);
					that.rulePriceJson = rulePriceJson;
					if (rulePriceJson.price !== 0) {
						that.price = rulePriceJson.price;
					} else {
						let colName = that.colorName;
						let priceArr = that.colorPriceJson[colName].priceArr ? that.colorPriceJson[
							colName].priceArr : '';
						priceArr.length >= 2 ? priceArr.sort() : '';
						priceArr.length >= 2 ? (priceArr = that.priceSort(priceArr)) : '';
						priceArr.length > 2 ? priceArr.splice(1, priceArr.length - 2) : '';
						that.priceString = priceArr.length >= 2 ? true : false;
						that.price = priceArr.length == 2 ? that.priceFixed(priceArr[0]) + ' - ' + that
							.priceFixed(priceArr[1]) :
							that.priceFixed(priceArr[0]);
						that.maxPrice = priceArr.length == 2 ? priceArr[1] : that.priceFixed(priceArr[0]);
						let markingPriceArray = that.colorPriceJson[colName].sizePrice;
						that.markingPrice = that.priceFixed(that.colorPriceJson[colName].sizePrice[0]
							.markingPrice);
					}
				}
			},

			// 创建购物袋获取cart_key
			initCart: async function(noAddCart) {
				let that = this;
				let isNoAdd = noAddCart;
				let merchantInfo = getApp().globalData.merchantInfo || uni.getStorageSync(
					MERCHANT_INFO);
				let cart_key = uni.getStorageSync(CART_KEY) || null;
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				if (cart_key == null || cart_key == '') {
					let cartRes = await api.initCart({
						method: 'POST',
						header: {
							jwt: customerInfo.jwt
						},
						query: {
							customerId: customerInfo.customerId,
							merchantId: merchantInfo.cloudMerchantId,
							orderSource: 'wxapp',
							storeId: merchantInfo.cloudMerchantStoreId
						}
					});
					cart_key = cartRes.data.cartKey;
					that.cartKey = cart_key;
					uni.setStorageSync(CART_KEY, cart_key);
					this.takeCart();
				}
			},

			//立即购买tracking
			buyItNowTracking() {
				this.commonTrack('c_ebmp_product_buy_now', {})
			},
			// 立即预约埋点
			appointmentTracking() {
				this.commonTrack('c_ebmp_product_book_now', {})
				this.$commonSensors.pdpEvent('PDPClick', this.detail, '立即预约', this.productPurchaseType, this.btnText == 1)
			},

			async buyItNow(type, typeNum) {
				let that = this;
				let userInfo = uni.getStorageSync(USER_INFO);
				const accountInfo = uni.getAccountInfoSync()
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData
					.customerInfo;
				if (!!type) {
					that.registerType = type;
				}
				let productSKU = JSON.stringify(this.productSKU);
				let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || '';
				if (!!this.$programSetting.openAppointment) {
					that.appointmentTracking();
				} else {
					that.buyItNowTracking();
					this.$commonSensors.pdpEvent('PDPClick', this.detail, '立即购买', this.productPurchaseType, this
						.btnText == 1)
				}

				if (!customerInfo && !userInfo) {
					that.getUserProfile();
					return false;
				} else if (!customerInfo && !!userInfo) {
					//获取商户信息
					let merchantInfo = uni.getStorageSync(MERCHANT_INFO);
					let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
					if (merchantInfo.cloudMerchantId) {
						//验证是否绑定已经存在用户
						let getCustomerInfo = await api.checkUser({
							method: 'POST',
							query: {
								appId: accountInfo.miniProgram.appId,
								merchantId: merchantInfo.cloudMerchantId,
								openId: userSpecialInfo.openid,
								loginToken: userSpecialInfo.loginToken
							}
						});
						// 没有注册
						if (getCustomerInfo.code !== 1000) {
							that.$refs.registerWidgetRef.openJoinMemberModal()
							return false;
						} else {
							uni.setStorageSync(CUSTOMER_INFO, getCustomerInfo.data);
							that.tianYuCheck(typeNum)
						}
					}
				} else {
					this.tianYuCheck(typeNum)
				}
			},

			tianYuCheck(type) {
				this.tianYuType = type
				const captchaShowInfo = uni.getStorageSync('captchaShowInfo')
				if (this.activitySwitch && !captchaShowInfo?.find((item) => (item.value == '抽签购商品'))) {
					this.buyReady()
				} else if (this.isSpecial && !captchaShowInfo?.find((item) => (item.value == 'TS商品'))) {
					this.buyReady()
				} else if ((!this.isSpecial && !this.activitySwitch) && !captchaShowInfo?.find((item) => (item.value ==
						'普通商品'))) {
					this.buyReady()
				} else {
					const arr = getCurrentPages();
					arr[arr.length - 1].selectComponent('#captcha').show();
					this.$commonSensors.popupEvent('PopupExposure', {
						'popup_type': '购买',
						'popup_name': '安全校验弹窗'
					})
				}
			},

			// 验证码验证结果回调
			handlerVerify: function(ev) {
				this.fromAddress = false
				let that = this
				if (ev.detail.ret === 0) {
					this.captchaTicket = ev.detail.ticket
					this.buyReady()
				}
			},
			// 加购登记前逻辑判断
			buyReady() {

				if (this.tianYuType == 1) {
					this.buyNowRequest()
				} else if (this.tianYuType == 0) {
					this.doTakeCart()
				} else if (this.tianYuType == 2) {
					// 抽签购登记
					let image = this.carouselArrId[0].type == 'video' ? this.carouselArrId[1]
						.url.split("?")[0] : this
						.carouselArrId[0].url.split("?")[0]
					let sharePic = this.activitySwitch ? this.activityInfo.shareCardPicUrl :
						'';
					let shareCardPicUrl = sharePic || this.shareImage || image
					let params = {
						skuId: this.activityInfo.skuId,
						activitySelectionId: this.activityInfo.activitySelectionId,
						drawStartTime: this.processTime[0].time,
						promulgateTime: this.processTime[1].time,
						activityEndTime: this.processTime[2].time,
						drawStartTrackTime: this.drawStartTrackTime,
						promulgateTrackTime: this.promulgateTrackTime,
						activityEndTrackTime: this.activityEndTrackTime,
						exEndTrackTime: this.exEndTrackTime,
						buyEndTrackTime: this.buyEndTrackTime,
						shareText: this.activityInfo.shareCardDesc,
						shareCardPicUrl: shareCardPicUrl,
						shareCardLink: this.activityInfo.shareCardLink,
						goodsId: this.goodsId,
						valueId: this.valueId,
						colorName: this.colorName,
						url: image,
						itemName: this.detail.itemName,
						price: this.price,
						publicationTime: this.activityInfo.promulgateTime,
						activityName: this.activityInfo.activitySelectionName,
						disableShare: this.disableShare,
						brand: this.trackBrand,
						series: this.trackSeries,
						degrees: this.trackDegrees,
						itemId: this.detail.itemId,
						remark: this.activityInfo.remark,
						levelname: this.levelName,
						sharePosterPath: this.sharePosterPath,
						captchaTicket: this.captchaTicket,
						spuId: this.detail.outerItemId,
						skuCode: this.detail.skus[0].skuCode,
						productVariant: this.colorName || ''
					}
					let options = JSON.stringify(params)
					this.fromAddress = true
					uni.navigateTo({
						url: '/pages/customer/address?type=draw&options=' +
							encodeURIComponent(options)
					})
				} else if (this.tianYuType == 3) {
					// 特殊购买立即购买
					this.buyNowRequest()
				} else if (this.tianYuType == 4) {
					// 抽签购立即购买
					this.buyNowRequest()
				}
			},
			buyNowRequest: async function() {
				let that = this;
				let userInfo = uni.getStorageSync(USER_INFO);
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
					
				let productSKU = JSON.stringify(this.productSKU);
				let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || '';
				let skuIdArr = []
				skuIdArr[0] = productSKU
				let res = await api.buyNow({
					method: 'POST',
					header: {
						jwt: customerInfo.jwt
					},
					query: {
						customerId: customerInfo.customerId,
						merchantId: merchantInfo.cloudMerchantId,
						orderSource: 'wxapp',
						skuId: productSKU,
						qty: this.chooseQty,
						storeId: merchantInfo.cloudMerchantStoreId,
						captchaTicket: this.captchaTicket
					}
				});
				if (res.code == 1000) {
					uni.setStorageSync('buyNowCartKey', res.data.cartKey);
					if (that.tianYuType == 3) { //特殊购买商品
						uni.navigateTo({
							url: '/pages/order/specialSubmit?skuIdArr=' +
								encodeURIComponent(JSON.stringify(skuIdArr)) +
								`&type=${(this.tsInfo && this.tsInfo.selectionEnabled)?'draw':''}`,
						});
						that.buyItNowTracking()
						this.$commonSensors.pdpEvent('PDPClick', this.detail, '立即购买', this.productPurchaseType, this
							.btnText == 1)
					} else if (that.tianYuType == 4) { //抽签购
						if (!this.activityInfo) {
							return false
						}
						//抽签购-立即购买埋点
						that.commonTrack('c_ebmp_draws_purchase', that.drawCommonTrack())
						let options = {
							activitySelectionRecordId: this.activityInfo
								.activitySelectionRecord.activitySelectionRecordId,
							activitySelectionName: this.activityInfo.activitySelectionName,
							drawAddInfo: this.activityInfo.activitySelectionRecord.customerAddress,
							identifier: this.ruleId
						}
						uni.navigateTo({
							// url: '/pages/order/drawSubmit?options=' + encodeURIComponent(JSON.stringify(options)),
							url: '/pages/order/drawSubmit?goodsId=' + this.goodsId + '&valueId=' + this.valueId +
								'&activitySelectionRecordId=' + this.activityInfo.activitySelectionRecord.activitySelectionRecordId
						});
					} else {
						uni.navigateTo({
							url: '/pages/order/submit?skuIdArr=' + encodeURIComponent(JSON.stringify(skuIdArr)),
						});
					}
					that.$commonSensors.popupEvent('PopupClick', {
						'popup_type': '商品弹窗',
						'popup_name': '半屏加购弹窗',
						'button_name': '立即购买'
					})
				} else {
					if (res.code == -1010) {
						that.handleShowTextToast('已超出限购数量，详情请咨询顾问');
					} else {
						that.handleShowTextToast(res.msg);
					}
				}
			},
			// 获取实时库存
			getAvailableQty: async function() {
				let that = this;
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				let params = {}
				if (!!customerInfo && !!customerInfo.jwt) {
					params = {
						header: {
							jwt: customerInfo.jwt
						}
					}
				}
				for (let i = 0; i < Object.keys(this.ccJson).length; i++) {
					const availableQtyJson = await api.getAvailableQty(params, uni
						.getStorageSync(MERCHANT_INFO)
						.cloudMerchantId,
						that.colorPriceJson[this.ccJson[Object.keys(this.ccJson)[i]]
							.valueName]?.skuCode);
					if (availableQtyJson.code === 1000) {
						that.colorPriceJson[that.colorName].qtyArr = availableQtyJson.data.availableQty;
						let data = availableQtyJson.data;
						if (!!customerInfo && availableQtyJson.data.availableQty <= 0 && !!that.enableArrivalNotice &&
							that
							.ccJson[that.valueId].approveStatus == "onsale") {
							that.arrivalReminder = true
							that.getArrivalStatus(i)
						}
						that.ccJson[Object.keys(that.ccJson)[i]].frontQty = data
							.availableQty;
						that.totalQtyOut = data.availableQty == 0 ? 1 : 0;
					}
				}
				this.$forceUpdate(); // 强制刷新
				return null
			},
			async getArrivalStatus(index) {
				let i = index ? index : 0
				let status = false;
				if (this.isSpAo) {
					status = await this.isSecondRemindRquestSpAo()
				} else {
					status = await getArrivalSubStatus(this.colorPriceJson[this.ccJson[Object.keys(this.ccJson)[i]]
						.valueName].skuCode)
				}

				this.arrivalBtnText = status ? '已设置开售提醒' : '到货提醒'

			},
			arrivalNowSubscribe: async function(type) {
				if (this.arrivalBtnText !== '到货提醒') {
					return false
				}
				let that = this
				let templateId = !this.isSpAo ? ['4SfLNnxKf26rpT4GO9w4PrrPzlFR40NBjZdOnXHNq8k'] : [
					'Dh-WY0caxLD6B1NQ2nqRSNCYHv5iaoZpxSTgHtQdcXY'
				];
				this.commonTrack('c_ebmp_product_click_arrival_notice', {})
				this.$commonSensors.popupEvent('PopupClick', {
					'popup_type': '商品弹窗',
					'popup_name': '半屏加购弹窗',
					'button_name': !this.isSpAo ? '到货提醒' : '活动开始提提醒'
				})
				let trackParams = {
					'c_miniprogram_template_name': '到货提醒',
					'c_miniprogram_template_id': templateId[0],
					'c_subscription_result': ''
				}
				that.$commonSensors.popupEvent('PopupExposure', {
					'popup_type': '订阅消息',
					'popup_name': '订阅消息弹窗'
				})
				that.$commonSensors.modelAuthAsk('商品', templateId)
				uni.requestSubscribeMessage({
					tmplIds: templateId,
					success(res) {
						if (res['4SfLNnxKf26rpT4GO9w4PrrPzlFR40NBjZdOnXHNq8k'] == "accept" || res[
								'Dh-WY0caxLD6B1NQ2nqRSNCYHv5iaoZpxSTgHtQdcXY'] == "accept") {
							if (that.isSpAo) {
								that.arrivalNowSpAo()
							} else {
								that.arrivalNow()
							}

							trackParams.c_subscription_result = '成功'
							that.$commonSensors.popupEvent('PopupClick', {
								'popup_type': '订阅消息',
								'popup_name': '订阅消息弹窗',
								'button_name': '允许'
							})
						} else {
							trackParams.c_subscription_result = '取消'
							that.$refs.failSubRef.open()
							that.$commonSensors.popupEvent('PopupClick', {
								'popup_type': '订阅消息',
								'popup_name': '订阅消息弹窗',
								'button_name': '拒绝'
							})
						}
						that.commonTrack('c_ebmp_subscribe_miniprogram_notification', trackParams)
					},
					fail(res) {},
					complete(res) {
						if (type == 'intent') {
							that.$refs.intentRef.closeModal()
						}
					}

				});
				that.$commonSensors.pdpEvent('PDPClick', that.detail, '到货提醒', that.productPurchaseType, that.btnText ==
					1,
					this.drawButtonText == '立即购买')
			},
			async arrivalNow() {
				let that = this
				let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
				const accountInfo = uni.getAccountInfoSync()
				let merchantInfo = uni.getStorageSync('merchantInfo');
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let page = `/pages/item/item?id=${this.goodsId}&valueId=${this.valueId}&valueName=${this.colorName}`
				if (customerInfo) {
					let res = await api.arrivalRemind({
						method: 'POST',
						header: {
							jwt: customerInfo.jwt,
							appId: accountInfo.miniProgram.appId
						},
						query: {
							frontCode: that.skuLists.skuProperties?.[0].frontCode,
							frontUrl: page,
							itemCode: that.itemCode,
							itemId: that.goodsId,
							itemName: that.detail.frontProperties?.[0].subtitle.split(',').join('') || that
								.itemName,
							mobile: customerInfo.mobile,
							nickName: customerInfo.nickName,
							openId: customerInfo.openId,
							skuCode: that.skuLists.skuCode,
							storeId: merchantInfo.cloudMerchantStoreId,
							unionId: customerInfo.unionId || 'unionId',
							valueId: that.valueId,
							valueName: that.colorName
						},
					});
					if (res.code == 1000 || res.code == 200) {
						that.arrivalBtnText = '已设置开售提醒'
						that.handleShowTextToast('订阅成功');
						return true
					} else {
						that.handleShowTextToast(res.msg)
						return false
					}
				}
			},
			async arrivalNowSpAo() {
				let that = this
				let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
				const accountInfo = uni.getAccountInfoSync()
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				if (customerInfo) {
					let res = await api.sendSubMessage({
						method: 'POST',
						header: {
							jwt: customerInfo.jwt
						},
						query: {
							name: "活动模版消息", // api.environment == 'trial' ? "Celeste B 活动通知测试" : "Celeste B 活动通知",
							appId: accountInfo.miniProgram.appId,
							openId: userSpecialInfo.openid,
							type: "活动消息",
							params: {
								activitySubscribeId: this.activitySubscribeId
							},
						},
					});

					if (res.code == 1000) {
						that.arrivalBtnText = '已设置开售提醒'
						that.handleShowTextToast('订阅成功');
						return true
					} else {
						that.handleShowTextToast(res.msg)
						return false
					}
				}
			},
			async isSecondRemindRquestSpAo() {
				let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO);
				const accountInfo = uni.getAccountInfoSync()
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
				let res = await api.getSaleMessage({
					method: 'POST',
					header: {
						jwt: customerInfo ? customerInfo.jwt : ''
					},
					query: {
						name: "活动模版消息", // api.environment == 'trial' ? "Celeste B 活动通知测试" : "Celeste B 活动通知",
						appId: accountInfo.miniProgram.appId,
						openId: userSpecialInfo.openid,
						type: "活动消息",
						params: {
							activitySubscribeId: this.activitySubscribeId
						},
					},
				})
				if (res.code !== 1000) {
					return false
				} else {
					return true
				}
			},
			// 点击加入购物袋
			takeCart: async function(type) {
				let that = this;
				this.ispopupClick = type || ''
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				let userInfo = uni.getStorageSync(USER_INFO);
				let merchantInfo = uni.getStorageSync('merchantInfo');

				if (this.btnText == 1 || this.btnText == 4) {
					if (this.btnText == 4) {
						wx.reLaunch({
							url: '/pages/item/categoryNew'
						});
					}
					return false;
				}
				if (!customerInfo && !userInfo) {
					that.registerType = 'cart';
					that.getUserProfile();
					return false;
				} else if (!customerInfo && !!userInfo) {
					that.registerType = 'cart';
					that.$refs.registerWidgetRef.openJoinMemberModal()
					return false;
				}

				let productSKU = JSON.stringify(that.productSKU);
				if (!this.canOrder) {
					return;
				}
				let cart_key = '';
				let res = await api.checkCart({
					method: 'POST',
					header: {
						jwt: customerInfo.jwt
					},
					query: {
						customerId: customerInfo.customerId,
						merchantId: merchantInfo.cloudMerchantId,
						orderSource: 'wxapp',
						storeId: merchantInfo.cloudMerchantStoreId
					}
				});

				if (res.code === 1000) {
					cart_key = res.data;
					that.cartKey = cart_key;
					uni.setStorageSync(CART_KEY, cart_key);
					that.tianYuCheck(0);
				} else {
					that.initCart();
					return false;
				}
			},
			//加入购物袋
			doTakeCart: async function() {
				let that = this;
				let data = that.skuLists;
				let arr = Object.keys(data);
				let customerInfo = uni.getStorageSync(CUSTOMER_INFO);
				let merchantInfo = uni.getStorageSync('merchantInfo');

				if (that.sizeIdx == -1 && that.sizeArr.length > 0) {
					return false;
				}
				let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
				const json = await api.addCart({
						method: 'POST',
						header: {
							jwt: jwt
						},
						query: {
							itemCode: that.detail.itemId,
							itemName: that.detail.itemName,
							qty: that.chooseQty,
							skuCode: that.skuLists.skuCode,
							skuId: that.skuLists.skuId,
							storeId: merchantInfo.cloudMerchantStoreId,
							captchaTicket: that.captchaTicket
						}
					},
					this.cartKey + '/item'
				);
				if (json.code === 1000) {
					let obj = {
						msg: '成功加入购物袋',
						success: true
					}
					this.handleCartToast(obj)
					that.$sr.track('add_to_cart', {
						"action_type": "append_to_cart",
						"sku": {
							"sku_id": that.skuLists.skuCode?.toString(),
							"sku_name": that.detail.itemName + that.colorName
						},
						"spu": {
							"spu_id": !!uni.getStorageSync('openOuterItemId') ? that.detail.outerItemId : !!uni
								.getStorageSync(
									'youshuOpencc') ? that.detail.frontProperties?.[0].frontCode?.toString() : that.detail.itemCode
								?.toString(),
							"spu_name": !!uni.getStorageSync('youshuOpencc') ? that.detail.itemName + that
								.detail
								.frontProperties?.[0].valueName : that.detail
								.itemName // 若商品无spu_name时，可传sku_name信息
						},
						"sku_category": [{
							"sku_cat_id": that.detail.categoryId?.toString() || '0',
							"sku_cat_name": "11",
							"sku_parent_cat_id": "null" // 若已是顶级类目，传"null"
						}],
						"shipping_shop": {
							"shipping_shop_id": merchantInfo.cloudMerchantId?.toString(), // 到家类型对接智慧零售入口必传
							"shipping_shop_name": "THE MACALLAN EBOUTIQUE麦卡伦" // 到家类型对接智慧零售入口必传
						},
						"sale": {
							"original_price": parseFloat(that.price),
							"current_price": parseFloat(that.price) == 0 ? parseFloat(that.markingPrice) : parseFloat(that
								.price)
						},
						"sku_num": that.chooseQty,
						"primary_image_url": that.carouselArrId?.[0]?.url.indexOf(".mp4") == -1 ? that
							.carouselArrId?.[0]
							?.url : that.carouselArrId?.[1]?.url
					})
					if (this.parameterShow) {
						this.parameterShow = false
					}
					// that.getCartList();
					// let enableMatomo = uni.getStorageSync('enableMatomo');
					// if (enableMatomo === true) {
					// 	let productSKU = JSON.stringify(that.productSKU);
					// 	getApp().matomo.addEcommerceItem(productSKU, that.itemName, that
					// 		.categoryName, that.price, 1);
					// 	getApp().matomo.trackEcommerceOrder(' ', 0, 0, 0, 0, false);
					// }
					this.$EFSTracking.trackingCart(that.detail.itemId, that.detail
						.itemName, that.detail.price, that.valueId,
						that.colorName, that.skuLists.skuCode, this.productPickImg, {});
					//加购埋点
					let objTrack = {};
					if (!!this.isSpecial) {
						objTrack.orderType = "会员活动"
						objTrack.purchaseType = "立即购买"
					} else {
						objTrack.orderType = "常规购买"
						objTrack.purchaseType = that.orderFlowText
					}

					that.commonTrack('c_ebmp_product_add_to_cart', {})
					that.$commonSensors.pdpEvent('PDPClick', that.detail, '加入购物袋', that.productPurchaseType, that
						.btnText == 1,
						this.drawButtonText == '立即购买')
					that.$commonSensors.addToCart(that.detail, that.chooseQty, this.productPurchaseType)
					if (!!that.ispopupClick) {
						that.$commonSensors.popupEvent('PopupClick', {
							'popup_type': '商品弹窗',
							'popup_name': '半屏加购弹窗',
							'button_name': '加入购物袋'
						})
					}
				} else {
					this.initCart(merchantInfo);
					if (json.msg) {
						if (json.code === -1010) {
							let obj = {
								msg: '已超出限购数量，详情请咨询顾问',
								success: false
							}
							this.handleCartToast(obj)
						} else {

							let obj = {
								msg: json.msg,
								success: false
							}
							this.handleCartToast(obj)
						}
					} else {
						let obj = {
							msg: '无法加入购物袋',
							success: false
						}
						this.handleCartToast(obj)
					}

				}
			},
			/**
			 * 加购提示
			 * @param {Object} obj
			 */
			async handleCartToast(obj) {
				const _arr = ['您动作太快，请慢点哟～', '网络状态不佳，请重试'];
				if(obj.msg && _arr.includes(obj.msg)){
					this.handleShowTextToast(obj.msg)
				}else if(obj.data && obj.data.msg && obj.data.type === 'showToast'){
					this.handleShowTextToast(obj.data.msg)
				}else{
					if (obj?.success) this.getCartList();
					this.cartMessage = obj?.msg || "加入购物车失败";
					this.cartStatus = obj?.success || false;
					this.showCartMsg = true;
					setTimeout(() => {
						this.showCartMsg = false;
					}, 3000);
				}
			},
			//获取购物袋商品列表
			getCartList: async function() {
				let that = this;
				let cart_key = uni.getStorageSync(CART_KEY);
				let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
				try {
					if (jwt && cart_key !== null) {
						that.$commonFunction.getCartList().then((res) => {
							if (res && res.items !== null) {
								getApp().globalData.cartNum = res.availableTotalQty;
								that.cartNum = res.availableTotalQty;
								that.$store.commit('changeCartNum', res.availableTotalQty);
								uni.setStorageSync('cartNum', res.availableTotalQty);
							}
						}).catch((err) => {
							that.handleShowTextToast(err.msg);
						});
					}
				} catch (err) {}
			},

			// 颜色切换
			pickerChange(index) {
				let that = this;
				this.colorIdx = index;
				const color = this.productArr[this.colorIdx];
				// 根据选择的颜色显示轮播图
				let carouselIndex = this.productArr[this.colorIdx];
				this.valueId = this.colorPriceJson[carouselIndex].valueId;
				this.uData = !!this.ccDescriptionJson[this.valueId] ? this
					.ccDescriptionJson[this.valueId].replace('<br />',
						'<p></p>') : this.uData;
				this.getGoodsPromotion();
				this.getPriceRules();
				let carouselArr = [];
				for (var i = 0; i < this.carousel.length; i++) {
					if (this.carousel[i].valueId == this.valueId && this
						.carousel[i].kind == 'loop') {
						carouselArr.push(that.carousel[i]);
						if (this.carousel[i].type == 'video' && this.carousel[i]
							.isDeleted == 0 && that.pdpShowVideoConfig) {
							that.$refs.swiperRef.setPlayStatus(false)
						}
					}
				}
				this.colorName = this.productArr[this.colorIdx];
				if (carouselArr.length === 0 && Object.keys(this.carousel[
						0]).length == 2) {
					this.carousel.slice(1);
					this.carousel.unshift({
						kind: 'loop',
						url: this.colorPriceJson[this.colorName].ccMainImage
					});
					for (let i = 1; i < this.carousel.length; i++) {
						if (this.carousel[i].url == this.carousel[0].url) {
							this.carousel.splice(i, 1);
							i--;
						}
					}
				}
				this.carouselArrId = carouselArr.length === 0 ? this
					.carousel : carouselArr;
				// 尺寸
				this.sizeArr = this.productColorList[color];
				if (that.ccJson[that.valueId].approveStatus !== 'onsale') {
					this.sizeArr.forEach(item => {
						item.qty = 0;
					});
				}
				if (this.sizeArr.length > 0) {
					this.skuLists = this.productList[this.productArr[this
						.colorIdx] + this.sizeArr[0].valueName];
				} else {
					this.skuLists = this.productList[this.productArr[this
						.colorIdx]];
				}
				this.productPickImg = this.skuLists.skuImageUrl;
				this.productSKU = this.skuLists.skuId;
				if (this.sizeArr && this.sizeArr.length == 1 && this
					.sizeArr[0] !== null) {
					this.sizeIdx = 0;
				} else {
					this.sizeIdx = -1;
				}
				let markingPriceArray = this.colorPriceJson[this
					.colorPriceJson.colorList[this.colorIdx]].sizePrice;
				this.markingPrice = that.priceFixed(this.colorPriceJson[this
					.colorPriceJson.colorList[this.colorIdx]].sizePrice[
					0].markingPrice / 1);
				for (let i = 0; i < markingPriceArray.length; i++) {
					this.markingPrice = parseInt(this.markingPrice) <
						parseInt(markingPriceArray[i].markingPrice) ? parseInt(
							markingPriceArray[i].markingPrice) : parseInt(this
							.markingPrice);
				}

				let priceArr = this.colorPriceJson[this.colorPriceJson
					.colorList[this.colorIdx]].priceArr;
				if (priceArr.length > 1 && this.rulePriceJson.hasRule ===
					false) {
					priceArr.length >= 2 ? priceArr.sort() : '';
					priceArr.length >= 2 ? (priceArr = that.priceSort(
						priceArr)) : '';
					priceArr.length > 2 ? priceArr.splice(1, priceArr.length -
						2) : '';
					this.colorPriceJson[this.colorPriceJson.colorList[this
							.colorIdx]].priceString = priceArr.length >= 2 ?
						true :
						false;
					this.price = priceArr.length == 2 ? that.priceFixed(
							priceArr[0]) + ' - ' + that.priceFixed(priceArr[1]) :
						this
						.detail.price;
					that.maxPrice = priceArr.length == 2 ? priceArr[1] : that
						.priceFixed(priceArr[0]);
					this.priceString = priceArr.length >= 2 ? true : false;
				} else if (priceArr.length === 1 && this.rulePriceJson
					.hasRule === false) {
					this.colorPriceJson[this.colorPriceJson.colorList[this
						.colorIdx]].priceString = false;
					this.priceString = false;
					this.price = that.priceFixed(priceArr[0]);
					that.maxPrice = that.priceFixed(priceArr[0]);
				}
				this.showPriceDescription =
					this.colorPriceJson[color].sallState.priceDescription ==
					null ||
					this.colorPriceJson[color].sallState.priceDescription ==
					undefined ||
					this.colorPriceJson[color].sallState.priceDescription ==
					'' ?
					false :
					true;
				let selQtyArr = this.colorPriceJson[this.colorPriceJson
					.colorList[this.colorIdx]].qtyArr;
				this.ccStock = selQtyArr.length == 1 && selQtyArr[0] == 0 ?
					true : false;
			},

			/**
			 * 公用分享方法
			 * @param  {[type]} params [description]
			 * @return {[type]}        [description]
			 */
			onShareAppMessage: function(res) {
				if (res.from === 'button') {
					// 来自页面内转发按钮
				} else {
					this.$EFSTracking.trackingAction('SHARE_CARD', res
						.from, {});
				}
				const goodsPath = '/pages/item/item?id=' + this.goodsId +
					'&valueId=' + this.valueId + '&valueName=' + this
					.colorName;
				let sharePic = this.activitySwitch ? this.activityInfo
					.shareCardPicUrl : '';
				let shareName = this.activitySwitch ? this.activityInfo
					.shareCardDesc : this.detail.itemName
				let url = sharePic || this.shareImage || this.carouselArrId[
					0].url
				let name = shareName || this.detail.itemName

				//右上角分享tracking
				let clShareParams = {
					"c_area": "右上角分享",
					"c_link_pagename": name,
					"c_link_path": goodsPath
				}
				this.shareTrack(clShareParams)

				if (this.navText !== '任务已完成' && this.taskCenterCode) {
					getApp().finishTask(this.taskCenterCode, this
						.taskContentId, this.taskContentName, 0)
					setTimeout(() => {
						uni.navigateBack({
							delta: 2
						})
					}, 3000);
				}
				this.$sr.setContext({ share_title: name || 'THE MACALLAN EBOUTIQUE麦卡伦' });
				this.$commonSensors.sensorsPageShare()
				return this.$commonFunction.commonShare(res, name, goodsPath, url);
			},

			onShareTimeline() {
				let sharePic = this.activitySwitch ? this.activityInfo
					.shareCardPicUrl : '';
				let url = sharePic || this.shareImage || this.carouselArrId[
					0].url;
				let title = this.activitySwitch ? this.activityInfo
					.shareCardDesc : ''
				return {
					title: title || this.detail.itemName,
					query: 'id=' + this.goodsId +
						'&valueId=' + this.valueId + '&valueName=' + this
						.colorName,
					imageUrl: url
				};
			},

			priceSort(arr) {
				let newArr = arr.map(v => Number(v));
				const sortFun = (a, b) => a - b; // a-b 从小到大  b-a 从大到小
				arr = newArr.sort(sortFun);
				return newArr.sort(sortFun);
			},
			trackWacth() {
				this.$commonSensors.simpleTrack('OnlineCustomerService')
				let clTrackPrams = {
					'c_pagename': this.nowPages
				}
				getApp().commonClTrack('c_ebmp_click_cs', clTrackPrams)
			},

		}
	};
</script>
<style lang="less">
	page {
		background-color: #fff;
	}

	.new-page-container {
		position: relative;
		width: 100%;
		display: flex;
		flex-flow: row wrap;
		justify-content: center;
		align-items: center;
		bottom: 80rpx;
		font-size: 14px;
		top: 1rpx;



		&.bottom100 {
			padding-bottom: 100rpx;
		}

		&.bottom106 {
			padding-bottom: 106rpx;
		}

		.intentbtn {
			flex: 1;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 31rpx;
			background-color: #000;
			color: #fff;
			flex: 1;
			height: 80rpx;
			line-height: 80rpx;
			margin-left: 16rpx;
			border-radius: 24px 8px 24px 24px;
			font-size: 28rpx;

			&.disable {
				background-color: #c6c6c6;
				color: #757575
			}
		}

		.set-hidden {
			opacity: 0;
		}

		.set-show {
			opacity: 1;
		}

		.font31 {
			font-size: 31rpx;
		}

		.has-btn-padding {
			padding: 0 40rpx
		}

		.u-countdown-colon {
			padding: 0 !important;
			font-size: 28rpx !important;
		}

		.u-countdown-item {
			padding: 0 !important;
		}

		.new-goods-tag-box {
			position: absolute;
			top: 32rpx;
			left: 32rpx;
			height: 56rpx;

			.new-goods-tag-item {
				position: absolute;
				top: 0;
				left: 0;
				height: 56rpx
			}
		}

		.detail-bottom-top {
			width: 100%;
			position: fixed;
			bottom: 0;
			background: #fff;
			z-index: 88;

			.disabled-buy {
				flex: 1;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				left: 0;
				top: 0;
				// background-color: rgb(174, 174, 174);
				background-color: #000;
				color: #fff;
				font-size: 28rpx;
				border-radius: 24px 8px 24px 24px;
				font-family: FrankNew-Regular,NotoSansSC-Regular;
				&.hasLogin {
					background-color: #000;
				}
			}

			.left-icon {
				width: 152rpx;
				justify-content: space-between;
				height: 88rpx;
				margin-right: 24rpx;

				.icon-image {
					height: 60rpx;
					display: flex;
					justify-content: center;
					align-items: center;
				}




				.icon-item {
					width: 64rpx;
					height: 100%;
					text-align: center;
					position: relative;

					image {
						width: 64rpx;
						// margin: 4rpx 0 -6rpx 0;
						margin: 0rpx 0 -6rpx 0;
					}

					// .number {
					// 	position: absolute;
					// 	right: 32rpx;
					// 	top: 2rpx;
					// 	color: #fff;
					// 	width: 30rpx;
					// 	height: 30rpx;
					// 	line-height: 30rpx;
					// 	padding: 0;
					// 	border-radius: 100%;
					// 	text-align: center;
					// 	font-size: 20rpx;
					// 	background-color: #CB171A;
					// }
					.number {
						position: absolute;
						right: 21rpx;
						top: 24rpx;
						color: #000;
						width: 22rpx;
						height: 14rpx;
						line-height: 30rpx;
						padding: 0;
						// border-radius: 100%;
						text-align: center;
						font-size: 14rpx;
						font-family: 'FrankNew-Regular';
						// background-color: #CB171A;
					}
				}
			}

			.right-btn {
				position: relative;
				width: 478rpx;
				// height: 100rpx;
				height: 80rpx
			}
		}

		.kf_button {
			// border-radius: 50%;
			overflow: hidden;
			background-image: url(https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/Help.png);
			background-size: 64rpx 64rpx;
			background-position: center;
			background-repeat: no-repeat;
			width: 64rpx;
			height: 64rpx;
			padding-left: 0;
			padding-right: 0;
			margin-left: 0;
			display: inline-block;
			margin-right: 0;
			margin: 0 0 -6rpx;
		}

		.ao-bottom {
			width: 654rpx;
			// height: 148rpx;
			height: 148rpx;
			margin: 0 auto;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;

			// padding-bottom: 64rpx;
			.short {
				width: 150rpx;
			}

			.right-btn {
				position: relative;
				width: 478rpx;
				// height: 100rpx;
				height: 80rpx;

				.btnBox {
					display: flex;
					flex: 1;
					justify-content: space-between;
					overflow: hidden;

					button {
						background-color: #1a1a1a;
						color: #fff;
						flex: 1;
						font-size: 28rpx;
						height: 80rpx;
						line-height: 80rpx;
						margin: 0;
						border-radius: 24px 8px 24px 24px;

						&.btn1 {
							width: 230rpx;
							background-color: #fff;
							color: #1a1a1a;
							border: 6rpx solid #000000;
							line-height: 68rpx;


						}

						&.btn2 {
							width: 230rpx;
							// margin-left: 16rpx;
							background-color: #000;
							color: #fff;

							&.act {
								// margin-left: 16rpx;
								background-color: #000;
								color: #fff;
							}

						}

						&.f-none {
							flex-shrink: 0;
							flex: none !important
						}
					}
				}
			}
		}

		.ts-bottom {
			width: 654rpx;
			// height: 148rpx;
			height: 148rpx;
			margin: 0 auto;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;

			.short {
				width: 150rpx;
			}
		}

		.drawLotsBottom {
			position: relative;
			width: 654rpx;
			height: 148rpx;
			margin: 0 auto;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;

			// padding-bottom: 64rpx;
			.drawrule {
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 28rpx;
				padding: 14rpx 0;

				.check-area {
					height: 60rpx;
					width: 36rpx;
				}

				.circle {
					width: 24rpx;
					height: 24rpx;
					border-radius: 50%;
					margin: 20rpx auto;
					border: 2rpx solid #000;
					text-align: center;

					&.checked {
						background: #000;
					}

					.mcl-check {
						color: #fff;
						font-size: 12rpx;
						margin-top: 4rpx;
					}
				}

				.rule-text {
					display: flex;
					align-items: center;
					font-size: 28rpx;

					.flex {
						font-size: 28rpx;

						.rule-name {
							text-decoration: underline;
							font-size: 28rpx;
							// border-bottom: 1px solid #000;
						}
					}
				}
			}

			.dlTextBox {
				position: absolute;
				top: -128rpx;
				left: -50rpx;
				width: 754rpx;
				height: 128rpx;
				line-height: 128rpx;
				text-align: left;
				padding: 0 56rpx 0 58rpx;
				font-size: 28rpx;
				color: #fff;
				font-family: FrankNew-Medium, NotoSansSC-Medium;
				letter-spacing: 0px;
				background-color: #000;
				display: flex;
				justify-content: flex-start;
				align-items: center;

				/* 灰字居中 */
				&.font1 {
					color: #757575;
				}

				/* 获得购买资格 */
				&.font2 {
					color: #862632;
					text-align: left;
				}

				/* 成功参与 */
				&.font3 {
					color: #862632;
				}
			}


			//--------------------------------------------------------
			.dlBtnBox {
				flex: 1;
				text-align: center;
				height: 80rpx;
				line-height: 80rpx;
				margin: 0;
				border-radius: 24px 8px 24px 24px;
				font-family: FrankNew-Medium, NotoSansSC-Medium !important;
				background-color: #C6C6C6;
				color: #757575;
				font-size: 28rpx;

				/* 链接或按钮样式 */
				&.link {
					background-color: #000;
					color: #fff;
				}
			}
		}

		.detail-bottom-top .left-icon-title {
			font-size: 20rpx;
			line-height: 20rpx;
			color: #1a1a1a;
		}

		.buy-num {
			width: 170rpx;
			display: flex;
			font-size: 24rpx;
			text-align: center;
			align-items: center;

			.jian-btn {
				width: 40rpx;
				height: 40rpx;
				font-size: 36rpx;

			}

			.numIcon {
				font-size: 36rpx;
			}

			.jia-btn {
				width: 40rpx;
				height: 40rpx;
			}

			.numjia {
				font-size: 36rpx;
			}

			input {
				border: none;
				width: 70rpx;
				height: 48rpx;
				min-height: 48rpx;
				text-align: center;
				font-size: 30rpx;
				z-index: 1;
			}

			.buy-number {
				border: none;
				width: 70rpx;
				font-size: 30rpx;
				z-index: 1;
			}
		}

		/*第二套购物袋样式*/
		.shoppingCart {
			position: relative;

			.new-title {
				width: 654rpx;
				height: 64rpx;
				color: #000;
				font-size: 14px;
				margin-bottom: 24rpx;
				display: flex;
				justify-content: space-around;
				flex-direction: row;

				.new-item-title-left {
					width: 500rpx;
					overflow: hidden;
					flex: 1;
					font-size: 28rpx;
					line-height: 64rpx;
				}

				.new-item-title-right {
					display: flex;
					flex-direction: row;
					justify-content: flex-end;
					align-items: center;
					width: 140rpx;

					.new-icon-image {
						width: 64rpx;
						height: 64rpx;
					}

					.new-share-btn {
						width: 64rpx;
						height: 64rpx;
						padding: 0;
						margin-left: 12rpx;
						margin-right: 0;
						background-color: transparent;

						.new-share-icon {
							image {
								width: 64rpx;
								height: 64rpx;
							}
						}
					}
				}

			}

			.cart-title {
				color: #000;
				font-size: 16px;
				margin-bottom: 12rpx;
				justify-content: space-around;

				.item-title-left {
					font-weight: 500;
					flex: 1;
					font-size: 36rpx;
					line-height: 52rpx;
					width: 570rpx;
				}



			}

			.cart-price {
				height: 56rpx;
				color: #989898;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;
				align-items: center;
				position: relative;

			}
			
			.cart-price-c2b{
				align-items: flex-start !important;
			}
			.new-v {
				margin-top: 64rpx;
				// margin-bottom: 18rpx;
				min-height: 56rpx;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: flex-start;
				.v-title{
					height: 56rpx;
					line-height: 56rpx;
					color: #757575;
					font-weight:400;
					font-size:28rpx;
					width: 67rpx;
					flex-shrink: 0;
					font-family: NotoSansSC-Regular;
				}
				.v-textbox{
					display: flex;
					display: flex;
					flex-direction: row;
					justify-content: flex-start;
					align-items: center;
					flex-wrap: wrap;
				}
			}

			.new-tag {
				height: 56rpx;
				margin-left: 16rpx;
				margin-bottom: 16rpx;
				font-size: 28rpx;
				box-sizing: border-box;
				line-height: 56rpx;
				border-radius: 28rpx;
				padding: 0 24rpx;
				overflow: hidden;
				font-family: FrankNew-Medium,NotoSansSC-Medium;
			}

			.tag-active {
				border: 2rpx solid #000;
				line-height: 52rpx;
			}

			.tag-d {
				background-color: #F2F2F2;
			}



			.linePrice {
				text-decoration: line-through;
				line-height: 40rpx;
				font-size: 40rpx;
			}

			.nowPrice {
				float: left;
				margin-left: 10rpx;
				color: #862633;
				line-height: 40rpx;
				font-size: 40rpx;
			}

			.price {
				text-align: center;
				line-height: 56rpx;
				font-size: 28rpx;
				// font-weight: bold;
			}

			.mark {
				line-height: 48rpx;
				font-size: 28rpx;
				margin-right: 2rpx;
			}

			.addShoppingCart {
				width: 100%;
				// padding: 14rpx 40rpx;
				color: #ffffff;
				background: #cccccc;
				margin-top: 50rpx;
				text-align: center;
			}
		}

		page {
			background-color: #fff;
		}

		.shoppingCart .cart-title,
		.shoppingCart .cart-price {
			color: #444;
		}

		.shoppingCart .cart-price {
			// margin-bottom: 24rpx;
		}


		.color-name {
			display: inline-block;
			vertical-align: top;
			line-height: 28px;
		}

		.shoppingCart .addShoppingCart {
			background-color: #444;
			margin: 0;
			width: 60%;
		}

		.shoppingCart .tooltip-text {
			display: none;
		}



		.shoppingCart .is-selected {
			border-bottom: none;
			box-shadow: inset 0 -2px 0 #444;
			margin-bottom: 11px;
		}

		.shoppingCart .description-header .is-selected {
			border-bottom: none;
			box-shadow: none;
			margin-bottom: 11px;
			font-weight: 600;
			color: #1a1a1a
		}


		.shoppingCart .product-description {
			margin-bottom: 25px;
			font-size: 12px;
			padding: 0 20rpx;
		}

		.shoppingCart .description-header {
			height: 80rpx;
			color: #999;
			text-align: left;
			padding: 0 20rpx;
		}

		.shoppingCart .description-header-new {
			height: 160rpx;
			line-height: 160rpx;
			color: #000;
			font-size: 28rpx;
			text-align: left;
			padding-left: 48rpx;
			font-family: 'NotoSansSC-Medium';
			// padding: 0 20rpx;
		}

		.shoppingCart .description-header span {
			line-height: 80rpx;
			text-align: center;
			padding: 60rpx 6rpx 0;
		}

		.shoppingCart .is-open {
			display: block;
		}

		.shoppingCart .is-selected {
			border-bottom: 1px solid #444;
			color: #444;
		}

		.fix-iphonex-button {
			bottom: 0 !important;
			// padding-bottom: 40rpx;
			padding-bottom: 64rpx;
		}

		.fix-iphonex-button::after {
			content: ' ';
			position: fixed;
			bottom: 0 !important;
			height: auto !important;
			width: 100%;
			background: #fff;
		}


		// 促销
		.promotion-box {
			display: flex;
			flex-flow: row wrap;
			// justify-content: center;
			color: #ff571a;
		}

		.marginBottom {
			margin-bottom: 25rpx;
		}

		.promotion-box span {
			padding-right: 10rpx;
		}



		.fade_in {
			animation: mymove 1s 1;
			animation-fill-mode: forwards;
			position: fixed;
		}

		@keyframes mymove {
			from {
				bottom: -30%;
			}

			to {
				bottom: 0%;
			}
		}

		.fade_out {
			animation: mymoveout 1s 1;
			animation-fill-mode: forwards;
			position: fixed;
		}

		@keyframes mymoveout {
			from {
				bottom: 0%;
			}

			to {
				bottom: -30%;
			}
		}


		.btn-box {
			display: flex;
			position: relative;
			width: 40%;
			padding: 0 18rpx;
		}

		.wxParse .p image {
			display: block;
			text-align: center;
			margin: 0 auto;
		}

		// 材质标签
		.material-tag {
			color: rgb(187, 187, 187);
			margin-bottom: 25rpx;
		}

		//自定义标签
		.custom-tag {
			text-align: center;
		}

		.font-act-color {
			color: #ff571a;
		}

		.btnBox1 {
			button {
				&:first-child {
					background-color: #ddd;
					color: #000;
					width: 420rpx;
				}
			}
		}

		.btnBox {
			display: flex;
			flex: 1;

			overflow: hidden;

			button {
				background-color: #1a1a1a;
				color: #fff;
				flex: 1;
				height: 80rpx;
				line-height: 80rpx;
				margin: 0;
				border-radius: 24px 8px 24px 24px;
				font-family: FrankNew-Medium, NotoSansSC-Medium;

				&.btn1 {
					border-right: 0;
					width: 230rpx;

					&.act {
						background-color: #000;
						color: #fff;
					}
				}

				&.btn2 {
					background-color: #b3b3b3;
					color: #fff;
					width: 230rpx;

					&.act {
						// margin-left: 16rpx;
						background-color: #000;
						color: #fff;
					}

					&.buyact {
						background: #000;
						font-size: 31rpx;
					}
				}

				&.f-none {
					flex-shrink: 0;
					flex: none !important
				}
			}
		}


		.fs18 {
			font-size: 18px;
		}

		.pl20 {
			padding-left: 20rpx;
		}

		.choose-size-box {
			padding: 30rpx;
			justify-content: space-between;
		}

		.mask-box {
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			z-index: 99;
			background-color: rgba(0, 0, 0, 0.5);
		}

		.mask-box-2 {
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			z-index: 99;
			background-color: rgba(0, 0, 0, 0.8);
		}

		.mask-main {
			padding: 0 40rpx;
		}

		.parameter-box {
			position: fixed;
			bottom: 0;
			left: 0;
			background-color: #fff;
			width: 100%;
			z-index: 101;
			flex-flow: column nowrap;
			padding: 40rpx 0;

			.parameter-close {
				text-align: right;
				font-size: 26px;
			}



			.right-btn {
				position: relative;
				width: 478rpx;
				height: 80rpx;

				.disabled-buy {
					flex: 1;
					padding: 28rpx;
					text-align: center;
					left: 0;
					top: 0;
					font-size: 31rpx;
					// background-color: rgb(174, 174, 174);
					background-color: #000;
					color: #fff;
					height: 100%;

					&.hasLogin {
						background-color: #000;
					}
				}
			}

			.parameter-info {
				flex-flow: row nowrap;

				.info-left {
					border: 1px solid rgb(247, 245, 244);
					margin-right: 20rpx;
					height: 140rpx;

					image {
						width: 140rpx;
						height: 100%;
					}
				}

				.info-right {
					.parameter-price {
						font-size: 16px;

						.mark {
							line-height: 48px;
							font-size: 28px;
						}
					}

					.has-choose {
						color: #bdbdbd;
					}
				}
			}

			.parameter-specifications {
				padding: 20rpx 0;

				.specifications-title {
					font-size: 16px;
					margin-bottom: 20rpx;
				}

				.specifications-item {
					display: inline-flex;
					color: #fff;
					padding: 20rpx;
					background-color: #ccc;
					margin-right: 20rpx;

					&.act {
						background-color: #000;
					}
				}
			}

			.change-count-box {
				padding: 20rpx 0;
				justify-content: space-between;
				align-items: center;
			}

			.promotion-box {
				padding-left: 20rpx;
			}

			.font-act-color {
				color: #666 !important
			}
		}

		.params-padding-box-3 {
			overflow: hidden;
			background: #FFFFFF;
			position: absolute;
			left: 48rpx;
			width: 654rpx;
			// height: 744rpx;
			padding-bottom: 96rpx;

		}

		.prams-box {
			.params-padding-box {
				height: 1304rpx;
				box-sizing: border-box;
				// padding: 60rpx 48rpx;
			}

			.params-padding-box-2 {

				box-sizing: border-box;
				position: relative
			}




			position: fixed;
			bottom: 0;
			left: 0;
			background-color: #fff;
			width: 100%;
			z-index: 99;
			flex-flow: column nowrap;

			.prams-close {
				font-size: 30px;
				text-align: right;
				position: absolute;
				right: 20rpx;
				top: 0rpx;
			}

			.title {
				text-align: center;
				font-size: 34rpx;
				padding-bottom: 30rpx;
			}

			.item-box {
				// padding: 36rpx 0;
				border-bottom: 2rpx solid #f7f5f4;
				height: 120rpx;
				box-sizing: border-box;

				.params-title {
					font-family: 'NotoSansSC-Medium';
					// font-weight: 500;
					width: 136rpx;
					font-size: 28rpx;
					height: 120rpx;
					line-height: 120rpx;
				}

				.params-content {
					font-family: 'FrankNew-Regular';
					font-weight: 400;
					// width: 260rpx;
					font-size: 28rpx;
					height: 120rpx;
					line-height: 120rpx;
				}
			}

			.full-btn {
				width: 100%;
				padding: 30rpx;
				background-color: #000;
				color: #fff;
				font-size: 30rpx;
				text-align: center;
			}
		}

		.mb20 {
			margin-bottom: 20rpx;
		}

		.bgbox {
			width: 100%;
			height: 20rpx;
			background-color: #f7f5f4;
		}

		.special-box {
			display: flex;
			align-items: center;
			justify-content: space-between;
			// margin-bottom: 10rpx;
		}

		.inte-tag {
			font-size: 20rpx;
			color: #fff;
			background: #CB171A;
			margin-bottom: 10rpx;
			height: 40rpx;
			display: flex;
			align-items: center;
			padding: 0 12rpx;
		}

		.general-tag {
			margin-bottom: 10rpx;
			margin-right: 16rpx;

			.m-icon {
				width: 40rpx;
				height: 40rpx;
				font-size: 26rpx;
				text-align: center;
				display: block;
				border: 2rpx solid #4d4d4d;
			}

			.m-tag {
				height: 40rpx;
				line-height: 40rpx;
				font-size: 20rpx;
				padding-left: 8rpx;
				padding-right: 12rpx;
				background-color: #4d4d4d;
				color: #fff;
			}
		}

		//轮播小点样式
		.wx-swiper-dot {
			width: 42rpx !important;
			height: 4rpx !important;
			border-radius: 0 !important;
			margin-left: -20rpx !important;
		}

		.wx-swiper-dots {
			display: flex;
			justify-content: center;
		}

		.wx-swiper-dots.wx-swiper-dots-horizontal {
			margin-bottom: 20px !important;
		}

		.swiper-dots-none {
			.wx-swiper-dots {
				display: none;
			}
		}



		.noticeBar {
			width: 100%;
		}

		.u-notice-box {
			margin: 0 !important;
		}

		.banner {
			position: relative;
			width: 100%;
			height: 200px;
		}

		.tabbody {
			position: relative;
			width: 100%;
		}

		.iconfont-font-20 {
			font-size: 20px;
		}

		.align-center {
			align-items: center;
		}

		.btn_sell_Out {
			color: #FFF !important;
			background-color: #AFAFAF !important;
			font-size: 32rpx;
		}

		.font-32 {
			border-radius: 24px 8px 24px 24px;
			font-size: 32rpx !important;
		}

		.disable {
			color: #757575 !important;
			background-color: #c6c6c6 !important;
		}


		.draw-progress {
			border-width: 2rpx 0 2rpx 0;
			border-style: solid;
			border-color: #F2F2F2;
			padding: 48rpx 48rpx 0;
			// margin-top: 40rpx;
		}

		.topView {
			position: fixed;
			top: 0;
			bottom: 0;
			left: 0;
			right: 0;
			z-index: 99;
			background-color: rgba(0, 0, 0, 0.64);

			.container {
				box-shadow: 0px 0px 6px 2px #333;
				position: absolute;
				top: 40%;
				width: 520rpx;
				height: 340rpx;
				background: #fff;
				margin: auto;
				left: 0;
				right: 0;

				.close {
					position: absolute;
					width: 40rpx;
					height: 40rpx;
					top: 4rpx;
					right: 10rpx;
					line-height: 50rpx;
					font-size: 44rpx;
					text-align: center;
				}

				.text {
					font-size: 28rpx;
					line-height: 45rpx;
					margin-top: 80rpx;
					margin: 80rpx 48rpx 56rpx;

					.under {
						border-bottom: 1px solid #000;
						display: inline-block;
						min-width: 18rpx;
					}
				}

				.checkBtnBox {
					margin: 0 48rpx;
					display: flex;
					justify-content: space-between;

					.btn {
						width: 196rpx;
						height: 68rpx;
						border: 1px solid #333;
						background: #fff;
						color: #000;
						display: flex;
						align-items: center;
						justify-content: center;

						&.submit {
							color: #fff;
							background: #000;
						}
					}
				}
			}
		}

		.flex {
			display: flex;
		}

		.arrival-new {

			color: #fff !important;
			background-color: #b3b3b3 !important;
		}

		.btn_invalid {
			font-size: 32rpx;
			background-color: #AFAFAF !important;
			color: #fff !important;
		}
	}

	//--------------------------------------------------------

	.progress-title-box {
		// margin-top: 48rpx;
		// width: 750px;
		height: 142rpx;
		line-height: 142rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding: 0 48rpx;
		font-size: 28rpx;
		font-family: NotoSansSC-Regular;


		.progress-title-btn-box {
			display: flex;
			flex-direction: row;
			justify-content: flex-end;
			align-items: center;

			.drawLotsRule {
				height: 40rpx;
				line-height: 40rpx;
				margin-left: 16rpx;
				font-family: 'NotoSansSC-Regular';
				font-weight: normal;
				font-size: 24rpx;
				letter-spacing: 0px;
				color: #000000;
				border-bottom: 2rpx solid #1A1A1A;
			}
		}

		.mask-box-2 {
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			z-index: 99;
			background-color: rgba(0, 0, 0, 0.8);
		}
	}
	.c2b_tips_btn{
		font-family: FrankNew-Medium,NotoSansSC-Medium;
		font-size: 28rpx;
		color: #000;
		line-height: 32rpx;
		border-bottom: 1px solid #000;
		padding-bottom: 8rpx;
		padding-top: 15rpx;
	}
	.not_click{
		color: #c6c6c6 !important;
		border-bottom: 1px solid #c6c6c6 !important;
	}
</style>